Pārlūkot izejas kodu

添加每天晚上计算绩效数据Job

luocaiyang 3 gadi atpakaļ
vecāks
revīzija
ea820e7655

+ 10 - 1
wispro.sp.api/Controllers/AppealController.cs

@@ -217,7 +217,16 @@ namespace wispro.sp.api.Controllers
 
                     Context.SaveChanges();
 
-                    //new PerformanceItemController(Context, new Services.FileTaskCacheService()).RefreshBasePoint();
+                    if(appealRecord.ItemId.HasValue)
+                    {
+                        var item = Context.PerformanceItems
+                            .Include(p => p.ItemStaffs)
+                            .Include(p => p.Customer)
+                            .Include(p=>p.Reviewer)
+                            .FirstOrDefault(p=>p.Id == appealRecord.ItemId);
+                        new PerformanceItemController(Context, new Services.FileTaskCacheService()).RefreshPoint(item);
+                    }
+                    
                     t.Commit();
 
                     return response;

+ 2 - 3
wispro.sp.api/Controllers/PerformanceItemController.cs

@@ -52,8 +52,6 @@ namespace wispro.sp.api.Controllers
             {
                 foreach (var item in itemList.ToList())
                 {
-
-
                     if (item != null)
                     {
                         Context.ItemStaffs.RemoveRange(item.ItemStaffs);
@@ -914,6 +912,8 @@ namespace wispro.sp.api.Controllers
             var calMonth = spDb.CalMonths.FirstOrDefault(c => c.Status == 0);
             _RefreshBasePoint(calMonth, spDb);
 
+            StatisticsLevelCount(calMonth.Year, calMonth.Month);
+
         }
 
         private void _RefreshBasePoint(CalMonth calMonth, spDbContext spDb)
@@ -1059,7 +1059,6 @@ namespace wispro.sp.api.Controllers
 
         public FileProcessTask CurrentData2Excel()
         {
-
             CalMonth calMonth = Context.CalMonths.FirstOrDefault(c => c.Status == 0);
             if (calMonth != null)
             {

+ 16 - 0
wispro.sp.api/Job/CalJXJob.cs

@@ -0,0 +1,16 @@
+using Quartz;
+using System.Threading.Tasks;
+using wispro.sp.api.Controllers;
+
+namespace wispro.sp.api.Job
+{
+    public class CalJXJob : IJob
+    {
+        public Task Execute(IJobExecutionContext context)
+        {
+            spDbContext spDb = new spDbContext();
+            new PerformanceItemController(spDb, new Services.FileTaskCacheService()).RefreshBasePoint();
+            return Task.CompletedTask;
+        }
+    }
+}

+ 10 - 0
wispro.sp.api/Program.cs

@@ -95,6 +95,16 @@ namespace wispro.sp.api
             _ = QuartzUtil.Add(typeof(AgentMessageJob), jobKey3, trigger3);
             #endregion
 
+            #region 每天计算绩效数据
+            JobKey jobCalJX = new JobKey("jobCalJX");
+            var triggerCalJX = TriggerBuilder.Create()
+                .WithDescription("绩效数据计算")
+                .WithSchedule(CronScheduleBuilder.CronSchedule("0 30 5 * * ?").WithMisfireHandlingInstructionDoNothing())
+                .Build();
+
+            _ = QuartzUtil.Add(typeof(CalJXJob), jobCalJX, triggerCalJX);
+            #endregion
+
             host.Run();
         }
 

+ 5 - 2
wispro.sp.web/Pages/AppCase/CaseManager.razor

@@ -98,14 +98,17 @@ RenderFragment gdIcon =
                             完成本期绩效计算,归档数据
                         </a>
 
-                        if(isDownloading){
+                        
+                    }
+
+                    if(isDownloading){
                             <Button Icon="download" Type="@ButtonType.Text" Loading>导出线下绩效计算报表</Button>
                         }
                         else
                         {
                             <Button Icon="download" Type="@ButtonType.Text" OnClick="() => ExportCurrentMonthJXList()">导出线下绩效计算报表</Button>
                         }
-                    }
+
                     @if (isDownloading)
                     {
                         <Button Icon="download" Type="@ButtonType.Text" Loading>导出</Button>