فهرست منبع

添加其它新申请绩效金额统计报表导出

luocaiyang 9 ماه پیش
والد
کامیت
955147f5a7

+ 1 - 0
wispro.sp.api/Controllers/CaseFileCompareController.cs

@@ -341,5 +341,6 @@ namespace wispro.sp.api.Controllers
 
         }
 
+
     }
 }

+ 71 - 0
wispro.sp.api/Controllers/PerformanceItemController.cs

@@ -895,6 +895,77 @@ namespace wispro.sp.api.Controllers
             return null;
         }
 
+        [Authorize]
+        public FileProcessTask OtherNewCaseAllocationReport(int Year, int Month)
+        {
+            CalMonth calMonth = Context.CalMonths.FirstOrDefault(c => c.Year == Year && c.Month == Month);
+            if (calMonth != null)
+            {
+                var filename = $"{DateTime.Now.ToString("yyyyMMddhhmmss")}-{calMonth.Year}{calMonth.Month}其它新申请代理人案件绩效金额统计.xlsx";
+                var attachfileSavePath = utility.ConfigHelper.GetSectionValue("AttachFileSavePath");
+                var filePath = Path.Combine(attachfileSavePath, filename);
+
+                var fileTask = new FileProcessTask()
+                {
+                    Id = Guid.NewGuid().ToString(),
+                    FileName = filename,
+                    FilePath = filePath,
+                    Processed = 0
+                };
+
+                fileTaskService.Add(fileTask);
+
+                ExportDataResult result = new ExportDataResult()
+                {
+                    fileTask = fileTask,
+                    calMonth = calMonth
+                };
+
+                System.Threading.Thread t = new System.Threading.Thread(new ParameterizedThreadStart(_OtherNewCaseAllocationReport));
+                t.Start(result);
+
+                return fileTask;
+            }
+
+            return null;
+        }
+
+        private void _OtherNewCaseAllocationReport(object exportDataResult)
+        {
+            ExportDataResult result = (ExportDataResult)exportDataResult;
+            FileProcessTask file = result.fileTask;
+            CalMonth calMonth = result.calMonth;
+
+            //var StatisticsResults = _CalMyStatistics(calMonth);
+            string strSQL = @" SELECT Staff.Name as 姓名,sum([ActualAmount]) as 绩效金额
+                  FROM [spDB].[dbo].[AllocationRatio],
+                  performanceItem,staff
+                  where Staff.Id = AllocationRatio.PersonId and PerformanceItem.Id= AllocationRatio.ItemId
+                  and ItemId in (select id from PerformanceItem where CalMonthId in (select id from CalMonth where year =@year and month=@month))
+                  group by Staff.Name
+                  order by Staff.Name";
+
+            DataTable dt = new DataTable();
+            spDbContext spDb = new spDbContext();
+            using (var conn = spDb.Database.GetDbConnection())
+            {
+                conn.Open();
+                var cmd = conn.CreateCommand();
+                cmd.CommandText = strSQL;
+                cmd.CommandType = CommandType.Text;
+
+                cmd.Parameters.Add(new SqlParameter("year", calMonth.Year));
+                cmd.Parameters.Add(new SqlParameter("month", calMonth.Month));
+                using (var reader = cmd.ExecuteReader())
+                {
+                    dt.Load(reader);
+                }
+            }
+
+            NPOIExcel.DataTableToExcel(dt, result.fileTask.FilePath);
+            result.fileTask.Finished = true;
+        }
+
         private void _GetOtherNewCaseAllocationReport(object exportDataResult)
         {
             ExportDataResult result = (ExportDataResult)exportDataResult;

+ 10 - 0
wispro.sp.web/Pages/AppCase/CaseManager.razor

@@ -148,6 +148,16 @@ RenderFragment gdIcon =
                                         <MenuItem>
                                             @if (isDownloading)
                                             {
+                                                <Button Icon="download" Type="@ButtonType.Text" Loading>导出其他新申请案件绩效金额统计报表</Button>
+                                            }
+                                            else
+                                            {
+                                                <Button Icon="download" Type="@ButtonType.Text" OnClick="() => ExportJXTotalMoneyAsync(HandlingCalMonth)">导出其他新申请案件绩效金额统计报表</Button>
+                                            }
+                                        </MenuItem>
+                                        <MenuItem>
+                                            @if (isDownloading)
+                                            {
                                                 <Button Icon="download" Type="@ButtonType.Text" Loading>导出案件数据</Button>
                                             }
                                             else

+ 17 - 0
wispro.sp.web/Pages/AppCase/CaseManager.razor.cs

@@ -224,6 +224,23 @@ namespace wispro.sp.web.Pages.AppCase
 
         }
 
+        private async Task ExportJXTotalMoneyAsync(CalMonth calMonth)
+        {
+            isDownloading = true;
+            var fileData = await _ItemService.ExportJXTotalMoneyAsync(calMonth.Year, calMonth.Month);
+
+            while (!fileData.Finished)
+            {
+                fileData = await _ItemService.getExportDataProcessing(fileData.Id);
+                await Task.Delay(20);
+            }
+
+            NavigationManager.NavigateTo($"{_configuration.GetValue<string>("APIUrl")}FileProcesTask/Download?Id={fileData.Id}");
+
+            isDownloading = false;
+
+        }
+
 
 
 

+ 6 - 0
wispro.sp.web/Services/PerformanceItemServices.cs

@@ -87,6 +87,12 @@ namespace wispro.sp.web.Services
             return fileData;
         }
 
+        public async Task<FileProcessTask> ExportJXTotalMoneyAsync(int Year, int month)
+        {
+            var fileData = await _httpClient.Get<FileProcessTask>($"PerformanceItem/OtherNewCaseAllocationReport?Year={Year}&Month={month}");
+            return fileData;
+        }
+
         public async Task<FileProcessTask> CurrentData2Excel(CalMonth calMonth)
         {
             var fileData = await _httpClient.Get<FileProcessTask>($"PerformanceItem/CurrentData2Excel?Year={calMonth.Year}&Month={calMonth.Month}");