Sfoglia il codice sorgente

我的绩效页面添加其他新申请绩效统计值
在绩效清单中添加其他新申请案件的绩效分配比率

luocaiyang 10 mesi fa
parent
commit
fba2aaa2a8

+ 49 - 8
wispro.sp.api/Controllers/PerformanceItemController.cs

@@ -867,6 +867,37 @@ namespace wispro.sp.api.Controllers
             result.fileTask.Finished = true;
         }
 
+        private List<StaffStatistics> _calMyOtherStatstics(CalMonth calMonth,int? userid)
+        {
+            var retList = Context.AllocationRatios.Where(s=>s.Item.CalMonth.Id == calMonth.Id);    
+
+            if(userid != null)
+            {
+                retList = retList.Where(s=>s.PersonId == userid);
+            }
+
+            var retData = retList.GroupBy(s => new {  s.PersonId })
+                            .Select(g => new
+                            {
+                                StaffId = g.Key.PersonId,
+                                FinianlPoint = g.Sum(s => s.ActualAmount),
+                            });
+
+            List<StaffStatistics> temList = new List<StaffStatistics>();
+            foreach (var key in retData)
+            {
+                temList.Add(new StaffStatistics()
+                {
+                    StaffId = key.StaffId,
+                    CalMonthId = calMonth.Id,
+                    jxType = "其他新申请",
+                    FinianlPoint = key.FinianlPoint
+                });
+            }
+
+            return temList;
+        }
+
         private List<StaffStatistics> _CalMyStatistics(CalMonth calMonth, int? userid = null)
         {
             var retList = Context.StaffStatistics.Where(s => s.CalMonthId == calMonth.Id);
@@ -2008,13 +2039,15 @@ namespace wispro.sp.api.Controllers
 
                     Context.SaveChanges();
 
-                    _calNDItemJx(new PerformanceItem() { Id = allocationRatios[0].ItemId }, Context);
+                    var item = Context.PerformanceItems.Where(i => i.Id == allocationRatios[0].ItemId).FirstOrDefault<PerformanceItem>();
+                    _calItemJX(item, Context);
 
                     t.Commit();
                 }
-                catch
+                catch(Exception ex)
                 {
                     t.Rollback();
+                    throw new ApplicationException(ex.Message);
                 }
             }
         }
@@ -2096,7 +2129,11 @@ namespace wispro.sp.api.Controllers
         }
         private void _calItemJX(PerformanceItem Item, spDbContext spDb)
         {
-            if(Item.Type == "其他新申请")
+            var oldJxList = spDb.StaffStatistics.Where(p => p.ItemId == Item.Id);
+            spDb.StaffStatistics.RemoveRange(oldJxList);
+            spDb.SaveChanges();
+
+            if (Item.Type == "其他新申请")
             {
                 _calNDItemJx(Item, spDb);
                 return;
@@ -2107,9 +2144,7 @@ namespace wispro.sp.api.Controllers
 
             var jxList = _calItemJX(verifyCoefficients, Item, spDb);
 
-            var oldJxList = spDb.StaffStatistics.Where(p => p.ItemId == Item.Id);
-            spDb.StaffStatistics.RemoveRange(oldJxList);
-            spDb.SaveChanges();
+            
             foreach (var jx in jxList)
             {
                 if (jx.totalBasePoint == 0)
@@ -2677,7 +2712,13 @@ namespace wispro.sp.api.Controllers
                 }
                 else
                 {
-                    return _CalMyStatistics(calMonth, userid);
+                    List<StaffStatistics> retList = _CalMyStatistics(calMonth, userid);
+                    List<StaffStatistics> otherList = _calMyOtherStatstics(calMonth, userid);
+                    if (otherList != null)
+                    {
+                        retList.AddRange(otherList);
+                    }
+                    return retList;
 
                     #region old code
                     //if (calMonth.Status == 4)
@@ -3127,7 +3168,7 @@ namespace wispro.sp.api.Controllers
             {
                 if (queryFilter.DoingOrReview == 0)
                 {
-                    response = new spDbContext().PerformanceItems.Where<PerformanceItem>(dynamicWhere).Where(s => (s.ItemStaffs.Where<ItemStaff>(iStaff => iStaff.DoPerson.Id == queryFilter.userId).Count() > 0));
+                    response = new spDbContext().PerformanceItems.Where<PerformanceItem>(dynamicWhere).Where(s => (s.ItemStaffs.Where<ItemStaff>(iStaff => iStaff.DoPerson.Id == queryFilter.userId).Count() > 0) || (s.ExternalHandlerId == queryFilter.userId && s.Type=="其他新申请"));
                 }
                 else
                 {

+ 15 - 1
wispro.sp.web/Pages/AppCase/CaseManager.razor

@@ -163,7 +163,7 @@ RenderFragment gdIcon =
                                 @serialNumber(_pageIndex, _pageSize, context.Id)
                             </AntDesign.Column>
 
-                            <AntDesign.Column Title="基础点数" TData="string" Width="100" Sortable>@(context.BasePoint == null ? "" : context.BasePoint)</AntDesign.Column>
+                            <AntDesign.Column Title="基础点数/绩效金额" TData="string" Width="100" Sortable>@(context.BasePoint == null ? "" : context.BasePoint)</AntDesign.Column>
                             <AntDesign.Column Title="绩效备注" Width="100" @bind-Field="@context.AgentFeedbackMemo" Sortable>
                                 <span>@(context.AgentFeedbackMemo == null ? "" : context.AgentFeedbackMemo)</span>
                             </AntDesign.Column>
@@ -215,6 +215,20 @@ RenderFragment gdIcon =
                                             <DescriptionsItem Title="案件名称" Span="2">@context.Data.CaseName</DescriptionsItem>
                                             <DescriptionsItem Title="申请人" Span="3">@context.Data.ApplicationName</DescriptionsItem>
                                             <DescriptionsItem Title="备注" Span="3">@context.Data.CaseMemo</DescriptionsItem>
+                                            @if(context.Data.Type == "其他新申请")
+                                            {
+                                                <DescriptionsItem Title="绩效分配比率" Span="3">
+                                                    @if(isExistAllocationRatios(context.Data))
+                                                    {
+                                                        @AllocationRatioString(context.Data)
+                                                    }
+                                                    else
+                                                    {
+                                                        getAllocationRatios(context.Data);
+                                                    }
+
+                                                </DescriptionsItem>
+                                            }
                                         </Descriptions>
                                     </Body>
                                 </Card>

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

@@ -325,5 +325,38 @@ namespace wispro.sp.web.Pages.AppCase
         {
             return null;
         }
+
+        private bool isExistAllocationRatios(PerformanceItem item)
+        {
+            return (item.AllocationRatios != null && item.AllocationRatios.Count > 0);
+        }
+
+        private string AllocationRatioString(PerformanceItem item)
+        {
+            string strTem = string.Empty;
+            if (item.AllocationRatios != null)
+            {
+                foreach (var ra in item.AllocationRatios)
+                {
+                    strTem = $"{strTem},{ra.Person.Name}【{ra.Ratio}%】";
+                }
+            }
+
+            if (!string.IsNullOrEmpty(strTem))
+            {
+                strTem = strTem.Substring(1);
+            }
+
+            return strTem;
+        }
+
+        private async Task getAllocationRatios(PerformanceItem item)
+        {
+            string strTem = "";
+            var ratios = await _ItemService.getARatios(item);
+            item.AllocationRatios = ratios;
+
+            StateHasChanged();
+        }
     }
 }

+ 28 - 2
wispro.sp.web/Pages/AppCase/MyCaselist.razor

@@ -111,6 +111,17 @@
                                     <AntDesign.Col Span="3" style="border:1px solid #000000"><center>@GetStatistics("专案处理")</center></AntDesign.Col>
                                     <AntDesign.Col Span="4" style="border:1px solid #000000"><center>@GetStatistics("ALL")</center></AntDesign.Col>
                                 </AntDesign.Row>
+                                <AntDesign.Row>
+                                    <AntDesign.Col Span="3" style="border:1px solid #000000"><center>其他新申请金额</center></AntDesign.Col>
+                                    <AntDesign.Col Span="2" style="border:1px solid #000000"><center>@GetStatistics("其他新申请")</center></AntDesign.Col>
+                                    <AntDesign.Col Span="2" style="border:1px solid #000000"><center></center></AntDesign.Col>
+                                    <AntDesign.Col Span="3" style="border:1px solid #000000"><center></center></AntDesign.Col>
+                                    <AntDesign.Col Span="3" style="border:1px solid #000000"><center></center></AntDesign.Col>
+                                    <AntDesign.Col Span="2" style="border:1px solid #000000"><center></center></AntDesign.Col>
+                                    <AntDesign.Col Span="2" style="border:1px solid #000000"><center></center></AntDesign.Col>
+                                    <AntDesign.Col Span="3" style="border:1px solid #000000"><center></center></AntDesign.Col>
+                                    <AntDesign.Col Span="4" style="border:1px solid #000000"><center>@GetStatistics("其他新申请")</center></AntDesign.Col>
+                                </AntDesign.Row>
 
                             </div>
                         </PageHeaderContent>
@@ -131,7 +142,7 @@
                             <AntDesign.Column Title="序号" TData="int" Width="50" Fixed="left">
                                 @serialNumber(_pageIndex, _pageSize, context.Id)
                             </AntDesign.Column>
-                            <AntDesign.Column Title="基础点数" Width="100" @bind-Field="@context.BasePoint" Sortable>
+                            <AntDesign.Column Title="基础点数/绩效金额" Width="100" @bind-Field="@context.BasePoint" Sortable>
                                 <span>@(context.BasePoint == null ? "" : context.BasePoint)</span>
                             </AntDesign.Column>
                             <AntDesign.Column Title="绩效备注" Width="100" @bind-Field="@context.AgentFeedbackMemo" Sortable>
@@ -158,7 +169,7 @@
                                     }
                                 }
                             </AntDesign.Column>
-                            <AntDesign.Column Title="对外处理人" TData="string" Width="100">@(context.Reviewer == null ? "" : context.ExternalHandler.Name)</AntDesign.Column>
+                            <AntDesign.Column Title="对外处理人" TData="string" Width="100">@(context.ExternalHandler == null ? "" : context.ExternalHandler.Name)</AntDesign.Column>
 
                             <AntDesign.Column Title="核稿人" TData="string" Width="100">@(context.Reviewer == null ? "" : context.Reviewer.Name)</AntDesign.Column>
 
@@ -216,6 +227,21 @@
                                             <DescriptionsItem Title="案件名称" Span="2">@context.Data.CaseName</DescriptionsItem>
                                             <DescriptionsItem Title="申请人" Span="3">@context.Data.ApplicationName</DescriptionsItem>
                                             <DescriptionsItem Title="备注" Span="3">@context.Data.CaseMemo</DescriptionsItem>
+                                            
+                                            @if(context.Data.Type == "其他新申请")
+                                            {
+                                                <DescriptionsItem Title="绩效分配比率" Span="3">
+                                                    @if(isExistAllocationRatios(context.Data))
+                                                    {
+                                                        @AllocationRatioString(context.Data)
+                                                    }
+                                                    else
+                                                    {
+                                                        getAllocationRatios(context.Data);
+                                                    }
+
+                                                </DescriptionsItem>
+                                            }
 
                                         </Descriptions>
                                     </Body>

+ 34 - 1
wispro.sp.web/Pages/AppCase/MyCaselist.razor.cs

@@ -8,6 +8,7 @@ using Microsoft.Extensions.Configuration;
 using Microsoft.JSInterop;
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Text.Json;
 using System.Threading.Tasks;
@@ -15,6 +16,7 @@ using wispro.sp.entity;
 using wispro.sp.share;
 using wispro.sp.web.Models;
 using wispro.sp.web.Services;
+using static Microsoft.AspNetCore.Hosting.Internal.HostingApplication;
 
 
 namespace wispro.sp.web.Pages.AppCase
@@ -217,7 +219,7 @@ namespace wispro.sp.web.Pages.AppCase
                     }
                     else
                     {
-                        return MyStatistics.Select(s => s.FinianlPoint.Value).Sum().ToString("0.00");
+                        return MyStatistics.Where(s=>s.jxType !="其他新申请").Select(s => s.FinianlPoint.Value).Sum().ToString("0.00");
                     }
                 }
             }
@@ -407,7 +409,38 @@ namespace wispro.sp.web.Pages.AppCase
 
         [Inject] IUserService _UserService { get; set; }
 
+        private bool isExistAllocationRatios(PerformanceItem item)
+        {
+            return (item.AllocationRatios != null && item.AllocationRatios.Count >0);
+        }
+        
+        private string AllocationRatioString(PerformanceItem item)
+        {
+            string strTem = string.Empty;
+            if (item.AllocationRatios != null)
+            {
+                foreach (var ra in item.AllocationRatios)
+                {
+                    strTem = $"{strTem},{ra.Person.Name}【{ra.Ratio}%】";
+                }
+            }
 
+            if (!string.IsNullOrEmpty(strTem))
+            {
+                strTem = strTem.Substring(1);
+            }
+
+            return strTem;
+        }
+
+        private async Task getAllocationRatios(PerformanceItem item)
+        {
+            string strTem = "";
+            var ratios = await _ItemService.getARatios(item);
+            item.AllocationRatios = ratios;
+            
+            StateHasChanged();
+        }
         async Task ShowModel(PerformanceItem Item,AppealType appealType)
         {
             var templateOptions = new Models.CreateAppealModel();