tangjiang 2 месяцев назад
Родитель
Сommit
b61c91e20e

+ 1 - 1
src/DataSharing.Host/StartupExtensions.cs

@@ -169,7 +169,7 @@ internal static class StartupExtensions
 
 
         //job
-        services.RegisterJob();
+        services.RegisterJob(sharingConfig);
         //services.AddSingleton<IAuthorizationPolicyProvider, AuthorizationPolicyProvider>();
         //services.AddSingleton<IAuthorizationHandler, PermissionHandler>();
 

+ 13 - 10
src/DataSharing.Host/StartupHelper.cs

@@ -185,7 +185,7 @@ namespace DataSharing.Host
         /// </summary>
         /// <param name="services"></param>
         /// <returns></returns>
-        public static IServiceCollection RegisterJob(this IServiceCollection services)
+        public static IServiceCollection RegisterJob(this IServiceCollection services, SharingConfiguration sharingConfig)
         {
             services.AddQuartz(d =>
             {
@@ -274,15 +274,18 @@ namespace DataSharing.Host
                     .WithCronSchedule("0/30 * * * * ? ")
                 );
 
-                //泸州110推送工单
-                var taskSendTaskLuZhou110Key = new JobKey("task-send-luzhou110-job", "task send luzhou110 job");
-                d.AddJob<TaskSendTaskLuZhou110Job>(taskSendTaskLuZhou110Key);
-                d.AddTrigger(t => t
-                    .WithIdentity("task-send-luzhou110-trigger")
-                    .ForJob(taskSendTaskLuZhou110Key)
-                    .StartNow()
-                    .WithCronSchedule("0/30 * * * * ? ")
-                );
+                if (sharingConfig != null && sharingConfig.CityCode == ConfigurationConsts.LuZhou)//泸州
+                {
+                    //泸州110推送工单
+                    var taskSendTaskLuZhou110Key = new JobKey("task-send-luzhou110-job", "task send luzhou110 job");
+                    d.AddJob<TaskSendTaskLuZhou110Job>(taskSendTaskLuZhou110Key);
+                    d.AddTrigger(t => t
+                        .WithIdentity("task-send-luzhou110-trigger")
+                        .ForJob(taskSendTaskLuZhou110Key)
+                        .StartNow()
+                        .WithCronSchedule("0/30 * * * * ? ")
+                    );
+                }
 
                 ////execute send task
                 //var taskExecuteJobKey = new JobKey("task-execute-job", "send task");

+ 0 - 4
src/DataSharing/LuZhou/LuZhou110/LZ110Invoker.cs

@@ -44,7 +44,6 @@ namespace DataSharing.LuZhou.LuZhou110
                 PropertyNamingPolicy = new JsonPascalNamingPolicy(),
             };
 
-            _logger.LogInformation($"发起请求LZ110:{request.GetRequestUrl()}");
             var result = await client.PostAsJsonAsync(request.GetRequestUrl(), request, serializeOptions, cancellationToken);
 
             if (result is null || !result.IsSuccessStatusCode)
@@ -80,8 +79,6 @@ namespace DataSharing.LuZhou.LuZhou110
                 PropertyNamingPolicy = new JsonPascalNamingPolicy(),
             };
 
-            _logger.LogInformation($"发起请求LZ110地址:{url}");
-            _logger.LogInformation($"发起请求LZ110内容:{stringContent}");
             //var result = await client.PostAsJsonAsync(url, new StringContent(stringContent, Encoding.UTF8, new MediaTypeWithQualityHeaderValue("application/json")), serializeOptions, cancellationToken);
 
             object requst = null;
@@ -109,7 +106,6 @@ namespace DataSharing.LuZhou.LuZhou110
 
             var result = await client.PostAsJsonAsync(url, requst, serializeOptions, cancellationToken);
 
-            _logger.LogInformation($"发起请求LZ110返回:{JsonConvert.SerializeObject(result)}");
             if (result is null || !result.IsSuccessStatusCode)
             {
                 _logger.LogError($"泸州110接口请求失败,request: {url}");

+ 3 - 3
src/DataSharing/LuZhou/LuZhou110/TaskSendTaskLuZhou110Job.cs

@@ -50,6 +50,9 @@ namespace DataSharing.LuZhou.LuZhou110
 
         public async Task Execute(IJobExecutionContext context)
         {
+            if (_sharingConfigurationManager.GetCityCode() != ConfigurationConsts.LuZhou)
+                return;
+
             var tasks = await _waitSendTaskLuZhou110Repository.Queryable()
               .Where(d => d.State == EWaitSendTaskState.WaitPush && d.SendTimes <= 3)
                .OrderBy(d => d.CreationTime)
@@ -98,13 +101,10 @@ namespace DataSharing.LuZhou.LuZhou110
                 try
                 {
                     response = await _lz110Invoker.RequestStringContentAsync<LZ110BaseResponse>(item.Path, item.Request, cancellationToken);
-                    _logger.LogInformation($"发起请求LZ110返回111111111:{JsonConvert.SerializeObject(response)}");
                     if (!response.IsSuccess && response?.Data?.ResponseStatusObject.StatusCode == "1")// ==1:未注册,==4:已注册
                     {
                         await _registerManager.RefreshRegisterAsync(cancellationToken);
-                        _logger.LogInformation($"发起请求LZ110返回222222:{JsonConvert.SerializeObject(response)}");
                         response = await _lz110Invoker.RequestStringContentAsync<LZ110BaseResponse>(item.Path, item.Request, cancellationToken);
-                        _logger.LogInformation($"发起请求LZ110返回333333:{JsonConvert.SerializeObject(response)}");
                     }
                 }
                 catch (Exception ex)