Murphy преди 3 години
родител
ревизия
c9e564aa7b

+ 1 - 0
MicroServices/Business/Business.Host/Business.Host.csproj

@@ -9,6 +9,7 @@
   </PropertyGroup>
 
   <ItemGroup>
+	 <PackageReference Include="GZY.Quartz.MUI" Version="2.3.0" />
 	 <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.3" />
     <PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.3" />
     <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.5">

+ 6 - 0
MicroServices/Business/Business.Host/BusinessHostModule.cs

@@ -4,11 +4,14 @@ using Business.Core.Utilities;
 using Business.EntityFrameworkCore;
 using Business.MultiTenancy;
 using Business.Quartz;
+using GZY.Quartz.MUI.EFContext;
+using GZY.Quartz.MUI.Extensions;
 using Microsoft.AspNetCore.Authentication.JwtBearer;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Cors;
 using Microsoft.AspNetCore.DataProtection;
 using Microsoft.AspNetCore.Hosting;
+using Microsoft.EntityFrameworkCore;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Hosting;
@@ -157,6 +160,8 @@ namespace Business
                 // when shutting down we want jobs to complete gracefully
                 options.WaitForJobsToComplete = true;
             });
+            context.Services.AddQuartzUI();
+            //context.Services.AddQuartzClassJobs(); //添加本地调度任务访问
             //context.Services.AddQuartzHostedService(options =>
             //{
             //    // when shutting down we want jobs to complete gracefully
@@ -336,6 +341,7 @@ namespace Business
             app.UseAbpSerilogEnrichers();
             app.UseUnitOfWork();
             app.UseConfiguredEndpoints();
+            app.UseQuartz();
             AsyncHelper.RunSync(async () =>
             {
                 using (var scope = context.ServiceProvider.CreateScope())

+ 1 - 0
MicroServices/Business/Business.Host/Program.cs

@@ -60,6 +60,7 @@ namespace Business
                 .ConfigureWebHostDefaults(webBuilder =>
                 {
                     webBuilder.UseStartup<Startup>();
+                    webBuilder.UseStaticWebAssets();
                 })
                 .UseAutofac()
                 //.UseSerilog()

+ 2 - 0
MicroServices/Business/Business.Host/Startup.cs

@@ -1,6 +1,7 @@
 using Business.Core.MongoDBHelper;
 using Business.EntityFrameworkCore.SqlRepositories;
 using Business.Quartz;
+using GZY.Quartz.MUI.Extensions;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.Extensions.DependencyInjection;
@@ -18,6 +19,7 @@ namespace Business
             services.AddScoped(typeof(ISqlRepository<>), typeof(SqlRepository<>));
             services.AddScoped<Config>();
             services.AddScoped<LogHostedService>();
+            services.AddScoped<GZY.Quartz.MUI.Areas.MyFeature.Pages.MainModel>();
         }
 
         public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)

+ 1 - 0
MicroServices/Business/QuartzSettings/task_job.json

@@ -0,0 +1 @@
+[{"TaskName":"测试定时任务","GroupName":"测试","Interval":"0 0 0 * * ?","ApiUrl":"http://123.60.180.165:8028/api/business/serialnumber","Describe":null,"LastRunTime":"2023-06-12T15:32:57","Status":6,"TaskType":2,"ApiRequestType":"GET","ApiAuthKey":null,"ApiAuthValue":null,"ApiParameter":"421240081346629","DllClassName":null,"DllActionName":null,"id":1,"timeflag":null,"changetime":null},{"TaskName":"定时任务","GroupName":"分组2","Interval":"0 0 10,14,16 * * ? ","ApiUrl":"http://123.60.180.165:8028/api/business/addon/demo","Describe":"测试定时任务,勿删","LastRunTime":"2023-06-12T15:31:30","Status":6,"TaskType":2,"ApiRequestType":"GET","ApiAuthKey":null,"ApiAuthValue":null,"ApiParameter":null,"DllClassName":null,"DllActionName":null,"id":2,"timeflag":null,"changetime":null}]