Prechádzať zdrojové kódy

添加客户新申请案A和S阈值控制模块
1、客户添加阈值
2、案件系数申诉时,如果超出阈值,提交给子敏审核;
3、案件系数审核时,如果超出阈值,提醒变更审核人为子敏

luocaiyang 2 rokov pred
rodič
commit
82902749ef
30 zmenil súbory, kde vykonal 535 pridanie a 95 odobranie
  1. 67 2
      wispro.sp.api/Controllers/AppealController.cs
  2. 5 0
      wispro.sp.api/Controllers/OrganizationController.cs
  3. 21 2
      wispro.sp.api/Controllers/PerformanceItemController.cs
  4. 51 9
      wispro.sp.api/Controllers/StaffController.cs
  5. 6 6
      wispro.sp.api/Job/InvalidDataMessageJob.cs
  6. 11 11
      wispro.sp.api/appsettings.json
  7. 10 0
      wispro.sp.utility/IPEasyUtility.cs
  8. 30 3
      wispro.sp.web/Components/CreateAppeal.razor
  9. 39 1
      wispro.sp.web/Components/CreateAppeal.razor.cs
  10. 2 1
      wispro.sp.web/Components/ReviewerAppeal.razor
  11. 2 2
      wispro.sp.web/Components/SSTable.razor.cs
  12. 3 1
      wispro.sp.web/Models/CreateAppealModel.cs
  13. 8 0
      wispro.sp.web/Models/ReviewerAppealModel.cs
  14. 62 2
      wispro.sp.web/Pages/AppCase/MyCaselist.razor.cs
  15. 11 0
      wispro.sp.web/Pages/CustomerList.razor
  16. 2 2
      wispro.sp.web/Pages/Organization/Department.razor.cs
  17. 1 1
      wispro.sp.web/Pages/Project/AssignPoint.razor
  18. 9 9
      wispro.sp.web/Pages/Report/AppealTrend.razor.cs
  19. 5 5
      wispro.sp.web/Pages/Report/StaffStaticsReport.razor.cs
  20. 64 1
      wispro.sp.web/Pages/Welcome.razor.cs
  21. 11 4
      wispro.sp.web/Services/AppealTypeService.cs
  22. 8 3
      wispro.sp.web/Services/AuthService.cs
  23. 7 0
      wispro.sp.web/Services/OrganizationService.cs
  24. 1 0
      wispro.sp.web/Services/UserService.cs
  25. 1 1
      wispro.sp.web/wwwroot/appsettings.json
  26. 25 17
      wispro.sp.winClient/Form1.Designer.cs
  27. 14 11
      wispro.sp.winClient/Form1.cs
  28. 1 1
      wispro.sp.winClient/appsettings.json
  29. 54 0
      wospro.sp.entity/CaseCoefficientStatistics.cs
  30. 4 0
      wospro.sp.entity/Customer.cs

+ 67 - 2
wispro.sp.api/Controllers/AppealController.cs

@@ -20,7 +20,7 @@ namespace wispro.sp.api.Controllers
 {
     [Route("api/[controller]/[action]")]
     [ApiController]
-    [Authorize]
+    //[Authorize]
     public class AppealController : ControllerBase
     {
         spDbContext Context;
@@ -35,6 +35,71 @@ namespace wispro.sp.api.Controllers
             return Context.AppealTypes.ToList();
         }
 
+        /// <summary>
+        /// 统计指定客户、指定月份新申请案件各案件系数的案件数量
+        /// </summary>
+        /// <param name="CustomerId">指定客户Id</param>
+        /// <param name="CalmonthId">指定月份Id</param>
+        /// <returns></returns>
+        public CaseCoefficientStatistics GetCCSRecord(int CustomerId,int CalmonthId)
+        {
+            CaseCoefficientStatistics retObject = new CaseCoefficientStatistics();
+            retObject.customer = Context.Customers.FirstOrDefault(c=>c.Id== CustomerId);
+
+            string strSQL = $"SELECT CaseCoefficient,count(*) as CaseCoefficientCount " +
+                            "FROM PerformanceItem " +
+                            $"where CalMonthId = {CalmonthId} and CustomerId = {CustomerId} and Type = '新申请' and(AgentFeedbackMemo <> '已算绩效' or AgentFeedbackMemo is null) " +
+                            "group by CaseCoefficient";
+            var conn= Context.Database.GetDbConnection();
+
+            if(conn.State != System.Data.ConnectionState.Open)
+            {
+                conn.Open();
+            }
+            
+            
+            try
+            {
+                var cmd = conn.CreateCommand();
+                cmd.CommandText = strSQL;
+                var reader = cmd.ExecuteReader();
+                
+                while (reader.Read())
+                {
+                    string strKey = (reader.IsDBNull(0) || string.IsNullOrEmpty(reader.GetString(0))) ? "B" : reader.GetString(0);
+                    switch (strKey)
+                    {
+                        case "A":
+                            retObject.ACount += reader.GetInt32(1);
+                            retObject.Totals += reader.GetInt32(1);
+                            break;
+                        case "S":
+                            retObject.SCount += reader.GetInt32(1);
+                            retObject.Totals += reader.GetInt32(1);
+                            break;
+                        default:
+                            retObject.Totals += reader.GetInt32(1);
+                            break;
+                    }
+                    
+                }
+
+                cmd.Dispose();
+
+                return retObject;
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            finally
+            {
+                
+                conn.Close();
+            }
+
+        }
+
         public List<InputField> GetInputField(int appealTypeId, int state)
         {
             var retList = Context.InputFields
@@ -425,7 +490,7 @@ namespace wispro.sp.api.Controllers
                 }
 
                 var retList = data
-                    //.Include(p => p.Reviewer)
+                    .Include(p => p.Reviewer)
                     .Include(p => p.Creater)
                     .Include(p => p.Item)
                     .Include(p => p.Type)

+ 5 - 0
wispro.sp.api/Controllers/OrganizationController.cs

@@ -198,6 +198,11 @@ namespace wispro.sp.api.Controllers
             return Context.Customers.ToList();
         }
 
+        public Customer GetCustomer(int id)
+        {
+            return Context.Customers.FirstOrDefault(c => c.Id == id);
+        }
+
         public ApiSaveResponse SaveCustomer(Customer customer)
         {
             ApiSaveResponse ret = new ApiSaveResponse();

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

@@ -102,15 +102,34 @@ namespace wispro.sp.api.Controllers
             {
                 try
                 {
+                    #region 已算绩效的案号只匹配案号前边的数字 20230310
+                    string[] strNos = item.CaseNo.Split(new char[] {'-'});
+                    string strNo = item.CaseNo;
+                    if(strNos.Length > 0 )
+                    {
+                        strNo = strNos[0];
+                        if(strNos.Length > 1)
+                        {
+                            if (strNos[1].ToUpper() == "TS")
+                            {
+                                strNo = $"{strNos[0]}-{strNos[1]}";
+                            }
+                        }
+                        
+                    }
+
                     var results = Context.PerformanceItems.Where<PerformanceItem>(x =>
-                       x.CaseNo == item.CaseNo && x.DoItem == item.DoItem && x.DoItem != "提出报告" && x.CaseStage == item.CaseStage);
+                       x.CaseNo.StartsWith(strNo) && x.DoItem == item.DoItem && x.DoItem != "提出报告" && x.CaseStage == item.CaseStage);
+                   
 
                     if (item.DoItem.ToUpper() == "提交IDS")
                     {
                         //提交IDS 添加完成日期做完判断是否已算绩效的条件
-                        results = Context.PerformanceItems.Where<PerformanceItem>(x => x.CaseNo == item.CaseNo && x.DoItem == item.DoItem && x.FinishedDate == item.FinishedDate);
+                        results = Context.PerformanceItems.Where<PerformanceItem>(x => x.CaseNo.StartsWith(strNo) && x.DoItem == item.DoItem && x.FinishedDate == item.FinishedDate);
                     }
 
+                    #endregion
+
                     var items = results.Include(pi => pi.CalMonth).FirstOrDefault<PerformanceItem>();
 
                     if (items != null)

+ 51 - 9
wispro.sp.api/Controllers/StaffController.cs

@@ -9,6 +9,8 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
 using Microsoft.AspNetCore.Authorization;
 using wispro.sp.entity.workflowDefine;
 using Microsoft.EntityFrameworkCore;
+using System.Collections;
+using NPOI.SS.Formula.Functions;
 
 namespace wispro.sp.api.Controllers
 {
@@ -41,14 +43,6 @@ namespace wispro.sp.api.Controllers
                 {
                     case UserConditionType.Staff:
 
-                        //UserField user = new UserField();
-                        //user.UserConditionType = UserConditionType.UserDepartmentPosition;
-                        //user.Department = "120";
-                        //user.Positon = "6";
-
-                        //System.Diagnostics.Debug.WriteLine(System.Text.Json.JsonSerializer.Serialize(user));
-                        
-
                         switch (userField.UserType)
                         {
                             case UserType.BindObjectProperty:
@@ -178,7 +172,31 @@ namespace wispro.sp.api.Controllers
                                     staff.ItemStaffs = null;
                                     staff.Positions = null;
                                     staff.ReviewerItems = null;
-                                    
+
+                                    #region 处理人为审核人,提交给部门顾问
+                                    if (apType.Name == "案件系数复核" || apType.Name == "特殊情况申诉")
+                                    {
+                                        foreach (var doPerson in item.ItemStaffs)
+                                        {
+                                            if (doPerson.DoPerson.Id == staff.Id)
+                                            {
+                                                if (AuditUsers().Contains(staff.Name))
+                                                {
+                                                    var temStaff = Context.Staffs
+                                                         .Where<Staff>(s => ((List<string>)AuditUsers()[staff.Name]).Contains(s.Name))
+                                                         .ToList();
+
+                                                    if (temStaff.Count > 0)
+                                                    {
+                                                        return temStaff;
+                                                    }
+                                                }
+                                                break;
+                                            }
+                                        }
+                                    }
+                                    #endregion
+
                                     retStaffs.Add(staff);
                                 }
                             }
@@ -193,6 +211,30 @@ namespace wispro.sp.api.Controllers
             }
         }
 
+        private Hashtable AuditUsers()
+        {
+            Hashtable retStaffs = new Hashtable();
+            retStaffs.Add("刘桂兰",new List<string>() { "程利", "周心志" });
+            retStaffs.Add("张庆玲", new List<string>() { "贾凤涛" });
+            retStaffs.Add("石惠", new List<string>() { "贾凤涛" });
+            retStaffs.Add("钟锦光", new List<string>() { "李庆波" });
+            retStaffs.Add("向鑫旭", new List<string>() { "李庆波" });
+            retStaffs.Add("张晓薇", new List<string>() { "李庆波" });
+            retStaffs.Add("杨超", new List<string>() { "李庆波" });
+            retStaffs.Add("沈靖俞", new List<string>() { "李庆波" });
+            retStaffs.Add("何丽", new List<string>() { "李庆波" });
+            retStaffs.Add("管自英", new List<string>() { "王建峰" });
+            retStaffs.Add("唐双", new List<string>() { "钟子敏" });
+            retStaffs.Add("李申", new List<string>() { "钟子敏" });
+            retStaffs.Add("翁旋艺", new List<string>() { "钟子敏" });
+            retStaffs.Add("何倚雯", new List<string>() { "钟子敏" });
+            retStaffs.Add("陆跃", new List<string>() { "钟子敏" });
+            retStaffs.Add("李姣", new List<string>() { "钟子敏" });
+            retStaffs.Add("李建民", new List<string>() { "钟子敏" });
+            retStaffs.Add("赵静", new List<string>() { "钟子敏" });
+            return retStaffs;
+        }
+
         public Staff GetUser(int Id)
         {
             return Context.Staffs.FirstOrDefault(p=>p.Id == Id);

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 6 - 6
wispro.sp.api/Job/InvalidDataMessageJob.cs


+ 11 - 11
wispro.sp.api/appsettings.json

@@ -43,19 +43,19 @@
   },
 
   "Authorize": {
-    "/Department": "[94]-[1],[128]-[7],[44]-[5]",
+    "/Department": "[94]-[1],[128]-[7],[44]-[5],[2]-[7]",
     "/Workflow/Manage": "[94]-[1],[44]-[5]",
-    "/CaseManager": "[94]-[1],[128]-[7],[44]-[5]",
-    "/Project/ProjectSearch": "[94]-[1],[128]-[7],[44]-[5],[28]-[5]",
-    "/AppealRecords": "[94]-[1],[128]-[7],[44]-[5]",
-    "/CustomerList": "[94]-[1],[128]-[7],[44]-[5]",
-    "/StaffGrade": "[94]-[1],[128]-[7],[44]-[5]",
-    "/LevelStatistics": "[94]-[1],[128]-[7],[44]-[5]",
-    "/Report/SingleChart": "[94]-[1],[128]-[7],[44]-[5]",
-    "/Report/AppealTrend": "[94]-[1],[128]-[7],[44]-[5]",
-    "/Report/StaticsTrend": "[94]-[1],[128]-[7],[44]-[5]"
+    "/CaseManager": "[94]-[1],[128]-[7],[44]-[5],[2]-[7]",
+    "/Project/ProjectSearch": "[94]-[1],[128]-[7],[2]-[7],[44]-[5],[28]-[5]",
+    "/AppealRecords": "[94]-[1],[128]-[7],[44]-[5],[2]-[7]",
+    "/CustomerList": "[94]-[1],[128]-[7],[44]-[5],[2]-[7]",
+    "/StaffGrade": "[94]-[1],[128]-[7],[44]-[5],[2]-[7]",
+    "/LevelStatistics": "[94]-[1],[128]-[7],[44]-[5],[2]-[7]",
+    "/Report/SingleChart": "[94]-[1],[128]-[7],[44]-[5],[2]-[7]",
+    "/Report/AppealTrend": "[94]-[1],[128]-[7],[44]-[5],[2]-[7]",
+    "/Report/StaticsTrend": "[94]-[1],[128]-[7],[44]-[5],[2]-[7]"
   },
 
-  "Lastest_feedback_date": "12"
+  "Lastest_feedback_date": "25"
 
 }

+ 10 - 0
wispro.sp.utility/IPEasyUtility.cs

@@ -91,6 +91,8 @@ namespace wispro.sp.utility
                 }
                 finally
                 {
+                    driver.Quit();
+                    driver.Dispose();
                     killChromProcess();
                 }
 
@@ -295,6 +297,8 @@ namespace wispro.sp.utility
                 finally
                 {
                     Log("关闭Chrome");
+                    driver.Quit();
+                    driver.Dispose();
                     killChromProcess();
                 }
 
@@ -398,6 +402,7 @@ namespace wispro.sp.utility
                 }
                 finally
                 {
+                    driver.Quit();
                     killChromProcess();
                 }
             }
@@ -549,6 +554,9 @@ namespace wispro.sp.utility
                         driver.FindElement(By.XPath($"//span[contains(text(),'扩展信息')]")).Click();
                         //select[@id='p_case_info__case_coefficient_id']
                         retObject.CaseCoefficient = GetSelectText(driver.FindElement(By.Id("p_case_info__case_coefficient_id")));
+
+                        
+
                     }
                     catch (Exception ex)
                     {
@@ -556,6 +564,8 @@ namespace wispro.sp.utility
                     }
                     finally
                     {
+                        driver.Quit();
+                        
                         killChromProcess();
 
                     }

+ 30 - 3
wispro.sp.web/Components/CreateAppeal.razor

@@ -11,13 +11,30 @@
             <AntDesign.Col Span="4"><b>处理事项:</b></AntDesign.Col>
             <AntDesign.Col Span="8">@_Model.Item.DoItem</AntDesign.Col>
         </Row>
-        <Row><AntDesign.Col Span="24">&nbsp;</AntDesign.Col></Row>
         <Row>
             <AntDesign.Col Span="4"><b>案件名称:</b></AntDesign.Col>
             <AntDesign.Col Span="20">@_Model.Item.CaseName</AntDesign.Col>
 
         </Row>
-    </div>
+            @if(_Model.Item.Customer != null)
+            {
+                <Row>
+                    <AntDesign.Col Span="4"><b>客户名称:</b></AntDesign.Col>
+                    <AntDesign.Col Span="20">@_Model.Item.Customer.Name</AntDesign.Col>
+                </Row>
+            }
+            @if (!string.IsNullOrEmpty(warningMessage))
+            {
+                <Row>
+                    <AntDesign.Col Span="24">
+                        <Alert Type="@AlertType.Warning"
+                               Message="@warningMessage"
+                               ShowIcon="true" />
+                    </AntDesign.Col>
+                </Row>
+                
+            }
+        </div>
 </Card>
 }
 
@@ -28,6 +45,7 @@
             <FormItem Label="请谁确认">
                 <StaffSelect @bind-StaffId="@context.AppealRecord.ReviewerId" StaffLists="_Staffs" />
             </FormItem>
+            
         }
 
         @foreach (InputField field in context.inputFields)
@@ -46,11 +64,19 @@
                                 @switch (temValue.InputField.FieldType)
                                 {
                                     case "System.String":
+                                        
                                         if (temValue.InputField.SelectValues != null && temValue.InputField.SelectValues.Count > 0)
                                         {
                                             <Select @bind-Value="@temValue.Value" DataSource="@temValue.InputField.SelectValues"
                                                     ValueName="@nameof(SelectValue.Value)"
                                                     LabelName="@nameof(SelectValue.Value)" />
+
+                                            //Console.WriteLine(context.AppealType.Name);
+                                            if (context.AppealType.Name == "案件系数复核")
+                                            {
+                                                //Console.WriteLine("案件系数复核");
+                                                <span>请注意客户案件系数比率!</span>
+                                            }
                                         }
                                         else
                                         {
@@ -71,8 +97,9 @@
                        
                 }
                 <Divider />
+                
 
-            }
+        }
             else
             {
                 @foreach (InputFieldValue temValue in fValues)

+ 39 - 1
wispro.sp.web/Components/CreateAppeal.razor.cs

@@ -2,6 +2,9 @@
 using Microsoft.AspNetCore.Components;
 using Microsoft.AspNetCore.Components.Forms;
 using Microsoft.Extensions.Configuration;
+using Microsoft.JSInterop;
+using ServiceStack;
+using ServiceStack.Messaging;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -34,6 +37,10 @@ namespace wispro.sp.web.Components
         [Inject]
         protected IConfiguration _configuration { get; set; }
 
+        [Inject]
+        protected OrganizationService _orgService { get; set; }
+
+        
         #region 文件上传控件设定
         //List<UploadFileItem> fileList = new List<UploadFileItem>();
 
@@ -63,10 +70,11 @@ namespace wispro.sp.web.Components
                 return false;
             }
         }
-        
+
         #endregion
 
 
+        private string warningMessage = "";
         protected override async void OnInitialized()
         {
             attrs = new Dictionary<string, object>
@@ -78,6 +86,35 @@ namespace wispro.sp.web.Components
 
             _Model = base.Options ?? new CreateAppealModel();
 
+            if (_Model.AppealType.Name == "案件系数复核")
+            {
+                
+                //判断是否案件系数是否A或S是否超过限额
+                Customer customer = _Model.Item.Customer;
+                
+                if (customer == null)
+                {
+                    //获取客户信息
+                    if(_Model.Item.CustomerId != null)
+                    {
+                        customer = await _orgService.GetCustomer(_Model.Item.CustomerId.Value);
+                    }
+                    
+                }
+
+                if(customer!= null)
+                {
+                    Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(customer));
+                    _Model.cssObject = await _atService.GetCaseCoefficientStatistics(customer.Id, _Model.Item.CalMonthId);
+
+                    if (_Model.cssObject != null && _Model.cssObject.isExceedingLimit())
+                    {
+                        warningMessage = $"客戶:{customer.Name}新申请案件S和A案件数已超过阈值,如果需要申请A或S的案件系数,请将审核人设置为钟子敏!";
+                    }
+                }
+                
+            }
+
             //if(!string.IsNullOrEmpty(_Model.AppealType.ReviewerExpress))
             //{
                 _Staffs =await _UserService.GetReviewers(_Model.AppealRecord.ItemId, _Model.AppealType.Id);
@@ -95,6 +132,7 @@ namespace wispro.sp.web.Components
 
         private async void OnFinish()
         {
+            
             await base.OnFeedbackOkAsync(new ModalClosingEventArgs() { Cancel = true });
         }
 

+ 2 - 1
wispro.sp.web/Components/ReviewerAppeal.razor

@@ -18,10 +18,11 @@
                     <AntDesign.Col Span="4"><b>案件名称:</b></AntDesign.Col>
                     <AntDesign.Col Span="20">@_Model.Item.CaseName</AntDesign.Col>
                 </Row>
+                
             </div>
         </Panel>
     }
-    <Panel Active="true" Header="@($"{@_Model.AppealRecord.Creater.Name}{@_Model.AppealRecord.CreateTime.ToString("yyyy-MM-dd")}提交如下审核内容")">
+    <Panel Active="true" Header="@($"{@_Model.AppealRecord.Creater.Name}{@_Model.AppealRecord.CreateTime.ToString("yyyy-MM-dd")}提交如下审核内容")">
         @*<Row>
                 <AntDesign.Col Span="4"><b>提交人:</b></AntDesign.Col>
                 <AntDesign.Col Span="8">@_Model.AppealRecord.Creater.Name</AntDesign.Col>

+ 2 - 2
wispro.sp.web/Components/SSTable.razor.cs

@@ -99,8 +99,8 @@ namespace wispro.sp.web.Components
 
             if (table.SortDirections.Count() > 0)
             {
-                Console.WriteLine(table.SortDirections[0].Name);
-                Console.WriteLine(table.SortDirections[0].Value);
+                //Console.WriteLine(table.SortDirections[0].Name);
+                //Console.WriteLine(table.SortDirections[0].Value);
             }
 
             return Datas.IndexOf(appealRecord) + 1;

+ 3 - 1
wispro.sp.web/Models/CreateAppealModel.cs

@@ -24,9 +24,11 @@ namespace wispro.sp.web.Models
 
         public List<UploadFileItem> FileList { get; set; }
 
+        public CaseCoefficientStatistics cssObject { get; set; }
+
         //public System.Collections.Hashtable _GroupInputValues { get; set; }
         //public List<InputFieldValue> noMultiValues { get; set; }
-        
+
         public CreateAppealModel() { }
 
         public async Task Init(AppealTypeService _atService,PerformanceItem item,AppealType appealType)

+ 8 - 0
wispro.sp.web/Models/ReviewerAppealModel.cs

@@ -25,6 +25,8 @@ namespace wispro.sp.web.Models
 
         public AppealRecord AppealRecord { get; set; }
 
+        public CaseCoefficientStatistics cssObject { get; set; }
+
         public async Task Init(AppealTypeService _atService, int appealRecordId)
         {
             this.AppealRecord =await _atService.getAppealRecord(appealRecordId);
@@ -34,6 +36,12 @@ namespace wispro.sp.web.Models
             inputFields = await _atService.GetInputFields(this.AppealRecord.TypeId, 1);
             attachFiles = await _atService.GetAppealRecordAttachFiles(this.AppealRecord.Id);
 
+            if(AppealRecord.Type.Name == "案件系数复核")
+            {
+                cssObject = await _atService.GetCaseCoefficientStatistics(Item.CustomerId, Item.CalMonthId);
+            }
+            
+
             inputFieldValues = new List<InputFieldValue>();
             foreach (var field in inputFields)
             {

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

@@ -177,7 +177,7 @@ namespace wispro.sp.web.Pages.AppCase
         private string GetStatistics(string strType, bool isBasePoint = false)
         {
             
-            Console.WriteLine(strType);
+            //Console.WriteLine(strType);
             try
             {
                 if (strType != "ALL")
@@ -405,12 +405,16 @@ namespace wispro.sp.web.Pages.AppCase
         [Inject] ModalService _ModalService { get; set; }
         [Inject]protected AppealTypeService _atService { get; set; }
 
-        
+        [Inject] IUserService _UserService { get; set; }
+
+
         async Task ShowModel(PerformanceItem Item,AppealType appealType)
         {
             var templateOptions = new Models.CreateAppealModel();
             await templateOptions.Init(_atService,Item, appealType);
 
+            //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(Item));
+
             var modalConfig = new ModalOptions();
             modalConfig.Title = appealType.Name;
             modalConfig.Width = 650;
@@ -431,6 +435,62 @@ namespace wispro.sp.web.Pages.AppCase
             {
                 try
                 {
+                    if (templateOptions.AppealType.Name == "案件系数复核")
+                    {
+                        var ifValue = templateOptions.inputFieldValues.Where(iv => iv.InputField.FieldName == "案件系数").FirstOrDefault();
+                        //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(templateOptions));
+                        var temCssObj = new CaseCoefficientStatistics()
+                        {
+                            Totals = templateOptions.cssObject.Totals,
+                            SCount = templateOptions.cssObject.SCount,
+                            ACount = templateOptions.cssObject.ACount,
+                            customer = templateOptions.cssObject.customer
+                        };
+
+                        if (ifValue != null)
+                        {
+                            switch (ifValue.Value)
+                            {
+                                case "S":
+                                    temCssObj.SCount += 1;
+                                    break;
+                                case "A":
+                                    temCssObj.ACount += 1;
+                                    break;
+                            }
+                        }
+
+                        switch (templateOptions.Item.CaseCoefficient)
+                        {
+                            case "S":
+                                temCssObj.SCount -= 1;
+                                break;
+                            case "A":
+                                temCssObj.ACount -= 1;
+                                break;
+                        }
+
+                        Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(temCssObj));
+
+                        if (temCssObj.isExceedingLimit())
+                        {
+                            var reviewer = await _UserService.GetUser(templateOptions.AppealRecord.ReviewerId.Value);
+                            
+                            if (reviewer.Name != "钟子敏")
+                            {
+                                var SuccessConfig1 = new ConfirmOptions()
+                                {
+                                    Content = $"客户:【{temCssObj.customer.Name}】新申请案件系数A或者S超出阈值,需要提交给“钟子敏”审核!"
+                                };
+
+                                _ModalService.Error(SuccessConfig1);
+                                
+                                //await JSRuntime.InvokeAsync<object>("alert", $"客户:【{temCssObj.customer.Name}】新申请案件系数A或者S超出阈值,需要提交给“钟子敏”审核!");
+                                return;
+                            }
+                        }
+                    }
+
                     await _atService.CreateAppeal(templateOptions);
                     await _modalRef.CloseAsync();
 

+ 11 - 0
wispro.sp.web/Pages/CustomerList.razor

@@ -47,6 +47,9 @@
                     <AntDesign.Column Title="地址" @bind-Field="@context.Address" Sortable Filterable />
                     <AntDesign.Column Title="联系人" @bind-Field="@context.ContactMan" Sortable Filterable />
                     <AntDesign.Column Title="电话" @bind-Field="@context.Phone" Sortable Filterable />
+                    <AntDesign.Column Title="A案件比率(%)" @bind-Field="@context.ARate" Sortable Filterable />
+                    <AntDesign.Column Title="S案件比率(%)" @bind-Field="@context.SRate" Sortable Filterable />
+
                     @*<AntDesign.Column Title="负责人" @bind-Field="@context.ResponseMan.Name" Sortable Filterable />*@
 
                     <ActionColumn>
@@ -88,6 +91,14 @@
             <Input @bind-Value="@context.ContactMan" />
         </FormItem>
 
+        <FormItem Label="A案件比率(%)">
+            <Input @bind-Value="@context.ARate" />
+        </FormItem>
+
+        <FormItem Label="S案件比率(%)">
+            <Input @bind-Value="@context.SRate" />
+        </FormItem>
+
         <FormItem Label="负责人">
             @*@if (context.ResponseMan == null)
             {

+ 2 - 2
wispro.sp.web/Pages/Organization/Department.razor.cs

@@ -260,9 +260,9 @@ namespace wispro.sp.web.Pages.Organization
         {
             //selectPosition = new Position() { Id = PositionId };
 
-            Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(_editDepartment));
+            //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(_editDepartment));
 
-            Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(EditingStaff));
+            //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(EditingStaff));
 
             var data = await orgService.SaveUser(_editDepartment, selectPosition, EditingStaff); // Http.PostAsJsonAsync<wispro.sp.entity.Staff>($"http://localhost:39476/api/Staff/Save", EditingStaff);
 

+ 1 - 1
wispro.sp.web/Pages/Project/AssignPoint.razor

@@ -45,7 +45,7 @@
                         }
                         else
                         {
-                            Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(task));
+                            //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(task));
                             <FormItem Label="我方文号">
                                 <span>@task.ProjectContentRecord.ProjectNo</span>
                             </FormItem>

+ 9 - 9
wispro.sp.web/Pages/Report/AppealTrend.razor.cs

@@ -64,7 +64,7 @@ namespace wispro.sp.web.Pages.Report
             
             if (args.Dates?.Length > 0)
             {
-                Console.WriteLine(args.Dates[0]);
+                //Console.WriteLine(args.Dates[0]);
                 
                 start = args.Dates[0];
             }
@@ -116,10 +116,10 @@ namespace wispro.sp.web.Pages.Report
                     series.Add(l);
                 }
 
-                Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(series, new JsonSerializerOptions()
-                {
-                    DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
-                }));
+                //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(series, new JsonSerializerOptions()
+                //{
+                //    DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
+                //}));
 
                 option = new()
                 {
@@ -168,10 +168,10 @@ namespace wispro.sp.web.Pages.Report
                     Series = series
                 };
 
-                Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(option, new JsonSerializerOptions()
-                {
-                    DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
-                }));
+                //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(option, new JsonSerializerOptions()
+                //{
+                //    DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
+                //}));
             }
         }
 

+ 5 - 5
wispro.sp.web/Pages/Report/StaffStaticsReport.razor.cs

@@ -164,15 +164,15 @@ namespace wispro.sp.web.Pages.Report
             //option = null;
             await GetChartDatas();
             
-            Console.WriteLine(chart.OptionRaw);
+            //Console.WriteLine(chart.OptionRaw);
         }
 
         private async Task OnButtonClick_1()
         {
-            Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(option, new JsonSerializerOptions()
-            {
-                DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
-            }));
+            //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(option, new JsonSerializerOptions()
+            //{
+            //    DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
+            //}));
 
             await msgService.Success(chart.OptionRaw);
         }

+ 64 - 1
wispro.sp.web/Pages/Welcome.razor.cs

@@ -10,6 +10,8 @@ using AntDesign;
 using System;
 using wispro.sp.share;
 using Microsoft.AspNetCore.Components.Web;
+using Microsoft.JSInterop;
+using System.Linq;
 
 namespace wispro.sp.web.Pages
 {
@@ -44,6 +46,10 @@ namespace wispro.sp.web.Pages
 
         [Inject] CalMonthServices CalMonthServices { get; set; }
 
+        [Inject] IUserService UserService { get; set; }
+
+        [Inject] IJSRuntime JSRuntime { get; set; }
+
         int waitingHandleItems = 0;
         int allItems = 0;
         
@@ -124,7 +130,64 @@ namespace wispro.sp.web.Pages
             var templateOptions = new Models.ReviewerAppealModel();
             await templateOptions.Init(_atService, appealRecord.Id);
 
-            //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(templateOptions));
+            Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(templateOptions));
+
+            if (templateOptions.AppealRecord.Type.Name == "案件系数复核")
+            {
+                var ifValue = templateOptions.CreateAppealFieldValues.Where(iv => iv.InputField.FieldName == "案件系数").FirstOrDefault();
+
+                if (ifValue.Value == "A" || ifValue.Value == "S")
+                {
+                    var temCssObj = new CaseCoefficientStatistics()
+                    {
+                        Totals = templateOptions.cssObject.Totals,
+                        SCount = templateOptions.cssObject.SCount,
+                        ACount = templateOptions.cssObject.ACount,
+                        customer = templateOptions.cssObject.customer
+                    };
+
+                    if (ifValue != null)
+                    {
+                        switch (ifValue.Value)
+                        {
+                            case "S":
+                                temCssObj.SCount += 1;
+                                break;
+                            case "A":
+                                temCssObj.ACount += 1;
+                                break;
+                        }
+                    }
+
+                    switch (templateOptions.Item.CaseCoefficient)
+                    {
+                        case "S":
+                            temCssObj.SCount -= 1;
+                            break;
+                        case "A":
+                            temCssObj.ACount -= 1;
+                            break;
+                    }
+
+
+                    if (temCssObj.isExceedingLimit())
+                    {
+                        var reviewer = await UserService.GetUser(templateOptions.AppealRecord.ReviewerId.Value);
+                        if (reviewer.Name != "钟子敏")
+                        {
+                            var SuccessConfig1 = new ConfirmOptions()
+                            {
+                                Content = $"客户:【{temCssObj.customer.Name}】新申请案件系数A或者S超出阈值,请将审核人变更为“钟子敏”!"
+                            };
+
+                            _ModalService.Error(SuccessConfig1);
+                            //await JSRuntime.InvokeAsync<object>("alert", $"客户:【{temCssObj.customer.Name}】新申请案件系数A或者S超出阈值,请将审核人变更为“钟子敏”!");
+                            return;
+                        }
+                    }
+                }
+            }
+            
 
             var modalConfig = new ModalOptions();
             modalConfig.Title = $"{appealRecord.Type.Name}审核" ;

+ 11 - 4
wispro.sp.web/Services/AppealTypeService.cs

@@ -86,7 +86,7 @@ namespace wispro.sp.web.Services
                 if (userid.HasValue)
                 {
                     var data = await _httpClient.Get<List<AppealRecord>>($"Appeal/GetAppealRecords?userId={userid}");
-                    Console.WriteLine();
+                    //Console.WriteLine();
                     return data;
                 }
                 else
@@ -96,7 +96,7 @@ namespace wispro.sp.web.Services
                 }
             }
             catch(Exception ex) {
-                Console.WriteLine(ex);
+                //Console.WriteLine(ex);
                 return new List<AppealRecord>();
             }
 
@@ -138,7 +138,7 @@ namespace wispro.sp.web.Services
         {
             List<AttachFile> attachFiles = new List<AttachFile>();
 
-            Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(model));
+            //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(model));
 
             foreach (var file in model.FileList)
             {
@@ -171,7 +171,7 @@ namespace wispro.sp.web.Services
             }
             catch(Exception ex)
             {
-                Console.WriteLine(ex.StackTrace);
+                //Console.WriteLine(ex.StackTrace);
                 throw ex;
             }
 
@@ -219,5 +219,12 @@ namespace wispro.sp.web.Services
             var data = await _httpClient.Get<ApiSaveResponse>($"Appeal/ChangeRecordReviewer?RecordId={changedRecord.Id}&ReviewerId={changedRecord.ReviewerId}");
             return data;
         }
+
+        public async Task<CaseCoefficientStatistics> GetCaseCoefficientStatistics(int? customerId,int calmonthId)
+        {
+            CaseCoefficientStatistics caseCoefficients =
+                    await _httpClient.Get<CaseCoefficientStatistics>($"Appeal/GetCCSRecord?CustomerId={customerId.Value}&CalmonthId={calmonthId}");
+            return caseCoefficients;
+        }
     }
 }

+ 8 - 3
wispro.sp.web/Services/AuthService.cs

@@ -105,12 +105,17 @@ namespace wispro.sp.web.Services
             }
             else
             {
+                
                 foreach (var uRole in _user.Roles)
                 {
-                    if (Roles.Contains(uRole))
+                    //Console.WriteLine(uRole);
+                    foreach(var role in Roles)
                     {
-                        canVisist = true;
-                        break;
+                        if(uRole.Contains(role))
+                        {
+                            canVisist = true;
+                            break;
+                        }
                     }
                 }
 

+ 7 - 0
wispro.sp.web/Services/OrganizationService.cs

@@ -129,6 +129,13 @@ namespace wispro.sp.web.Services
             return data;
         }
 
+        public async Task<Customer> GetCustomer(int id)
+        {
+            var data = await _httpClient.Get<Customer>($"Organization/GetCustomer?id={id}");
+
+            return data;
+        }
+
         public async Task Init()
         {
              await _httpClient.Get<ApiSaveResponse>("Staff/Init");

+ 1 - 0
wispro.sp.web/Services/UserService.cs

@@ -64,6 +64,7 @@ namespace wispro.sp.web.Services
 
                 if(claim.Type == ClaimTypes.Role)
                 {
+                    //Console.WriteLine($"user Roles:{claim.Value}");
                     _user.Roles.Add(claim.Value);
                 }
             }

+ 1 - 1
wispro.sp.web/wwwroot/appsettings.json

@@ -17,5 +17,5 @@
   },
 
   "APIUrl": "http://localhost:39476/api/",
-  "Latest_feedback_date": "12"
+  "Latest_feedback_date": "25"
 }

+ 25 - 17
wispro.sp.winClient/Form1.Designer.cs

@@ -40,9 +40,10 @@ namespace wispro.sp.winClient
             // 
             // button1
             // 
-            this.button1.Location = new System.Drawing.Point(52, 69);
+            this.button1.Location = new System.Drawing.Point(61, 80);
+            this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(257, 68);
+            this.button1.Size = new System.Drawing.Size(304, 79);
             this.button1.TabIndex = 0;
             this.button1.Text = "合并反馈文档";
             this.button1.UseVisualStyleBackColor = true;
@@ -50,9 +51,10 @@ namespace wispro.sp.winClient
             // 
             // button2
             // 
-            this.button2.Location = new System.Drawing.Point(351, 69);
+            this.button2.Location = new System.Drawing.Point(415, 80);
+            this.button2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.button2.Name = "button2";
-            this.button2.Size = new System.Drawing.Size(257, 68);
+            this.button2.Size = new System.Drawing.Size(304, 79);
             this.button2.TabIndex = 0;
             this.button2.Text = "输入绩效基本点数";
             this.button2.UseVisualStyleBackColor = true;
@@ -60,9 +62,10 @@ namespace wispro.sp.winClient
             // 
             // button3
             // 
-            this.button3.Location = new System.Drawing.Point(634, 69);
+            this.button3.Location = new System.Drawing.Point(749, 80);
+            this.button3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.button3.Name = "button3";
-            this.button3.Size = new System.Drawing.Size(257, 68);
+            this.button3.Size = new System.Drawing.Size(304, 79);
             this.button3.TabIndex = 0;
             this.button3.Text = "计算绩效";
             this.button3.UseVisualStyleBackColor = true;
@@ -70,9 +73,10 @@ namespace wispro.sp.winClient
             // 
             // button5
             // 
-            this.button5.Location = new System.Drawing.Point(269, 159);
+            this.button5.Location = new System.Drawing.Point(318, 186);
+            this.button5.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.button5.Name = "button5";
-            this.button5.Size = new System.Drawing.Size(171, 45);
+            this.button5.Size = new System.Drawing.Size(202, 52);
             this.button5.TabIndex = 1;
             this.button5.Text = "获取绩效报表";
             this.button5.UseVisualStyleBackColor = true;
@@ -80,9 +84,10 @@ namespace wispro.sp.winClient
             // 
             // button6
             // 
-            this.button6.Location = new System.Drawing.Point(494, 159);
+            this.button6.Location = new System.Drawing.Point(584, 186);
+            this.button6.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.button6.Name = "button6";
-            this.button6.Size = new System.Drawing.Size(171, 45);
+            this.button6.Size = new System.Drawing.Size(202, 52);
             this.button6.TabIndex = 1;
             this.button6.Text = "更新绩效数据";
             this.button6.UseVisualStyleBackColor = true;
@@ -90,9 +95,10 @@ namespace wispro.sp.winClient
             // 
             // button7
             // 
-            this.button7.Location = new System.Drawing.Point(719, 159);
+            this.button7.Location = new System.Drawing.Point(850, 186);
+            this.button7.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.button7.Name = "button7";
-            this.button7.Size = new System.Drawing.Size(171, 45);
+            this.button7.Size = new System.Drawing.Size(202, 52);
             this.button7.TabIndex = 1;
             this.button7.Text = "发送疑似问题通知";
             this.button7.UseVisualStyleBackColor = true;
@@ -100,19 +106,20 @@ namespace wispro.sp.winClient
             // 
             // button4
             // 
-            this.button4.Location = new System.Drawing.Point(44, 158);
+            this.button4.Location = new System.Drawing.Point(33, 184);
+            this.button4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.button4.Name = "button4";
-            this.button4.Size = new System.Drawing.Size(197, 44);
+            this.button4.Size = new System.Drawing.Size(252, 51);
             this.button4.TabIndex = 2;
-            this.button4.Text = "button4";
+            this.button4.Text = "重新计算季度考核信息";
             this.button4.UseVisualStyleBackColor = true;
             this.button4.Click += new System.EventHandler(this.button4_Click_1);
             // 
             // Form1
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(13F, 28F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(925, 215);
+            this.ClientSize = new System.Drawing.Size(1093, 251);
             this.Controls.Add(this.button4);
             this.Controls.Add(this.button7);
             this.Controls.Add(this.button6);
@@ -121,6 +128,7 @@ namespace wispro.sp.winClient
             this.Controls.Add(this.button2);
             this.Controls.Add(this.button1);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.Name = "Form1";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.Text = "人力绩效计算工具";

+ 14 - 11
wispro.sp.winClient/Form1.cs

@@ -39,6 +39,9 @@ namespace wispro.sp.winClient
         
         private void button1_Click(object sender, EventArgs e)
         {
+            IPEasyUtility.GetCaseInfo("PACN2312781");
+            return;
+
             DateTime startTime = DateTime.Now;
             frmMerageExcel frm = new frmMerageExcel();
 
@@ -958,14 +961,14 @@ namespace wispro.sp.winClient
             return retStr;
         }
 
-        string strAPIBaseUri = "http://1.116.113.26:81";//"http://localhost:8080"; // "http://localhost:39476";//   "http://47.106.221.167:8081"; //  
+        string strAPIBaseUri = "http://1.116.113.26:81";//"http://localhost:39476";// "http://localhost:8080"; //   "http://47.106.221.167:8081"; //  
 
         userToken Token;
 
         public async Task GetTest()
         {
             await Login();
-            string strUrl = $"{strAPIBaseUri}/api/PerformanceItem/CurrentData2Excel";
+            string strUrl = $"{strAPIBaseUri}/api/PerformanceItem/CurrentDatav2Excel";
             HttpClient http = CreateHttp();
             http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("bearer", Token.Token);
 
@@ -1420,12 +1423,12 @@ namespace wispro.sp.winClient
         }
         private async void button4_Click_1(object sender, EventArgs e)
         {
-            dynamic ret = await GetPerformanceItemFromIPEasy();
-            //if (ret != null)
-            {
-                //System.Diagnostics.Debug.WriteLine(ret.ToString());
-            }
-            return;
+            //dynamic ret = await GetPerformanceItemFromIPEasy();
+            ////if (ret != null)
+            //{
+            //    //System.Diagnostics.Debug.WriteLine(ret.ToString());
+            //}
+            //return;
 
             if (Token == null)
             {
@@ -1436,11 +1439,11 @@ namespace wispro.sp.winClient
 
             //await StatisticsLevelCount(2022, 3);
 
-            await StatisticsLevelCount(2022, 4);
+            await StatisticsLevelCount(2023, 1);
 
-            await StatisticsLevelCount(2022, 5);
+            await StatisticsLevelCount(2023, 2);
 
-            await StatisticsLevelCount(2022, 6);
+            //await StatisticsLevelCount(2022, 6);
 
         }
     }

+ 1 - 1
wispro.sp.winClient/appsettings.json

@@ -4,7 +4,7 @@
     "isHeadless": "false",
     "Account": "caiyangl",
     "Password": "j)wx*lier*@3",
-    "ChormeDriverPath": "D:\\source\\repos\\StaffPerformance\\packages\\ChormeDriver\\110.0.5481.77",
+    "ChormeDriverPath": "D:\\source\\repos\\StaffPerformance\\packages\\ChormeDriver\\113.0.5672.63",
     "ScheduleSetting": "00 55 10 3 * ? *",
     "IPEasyWeb": "http://47.106.221.167/Login.aspx"
   },

+ 54 - 0
wospro.sp.entity/CaseCoefficientStatistics.cs

@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace wispro.sp.entity
+{
+    public class CaseCoefficientStatistics
+    {
+        public Customer customer { get; set; }
+
+        public int Totals { get; set; } 
+
+        public int ACount { get; set; }
+
+        public int SCount { get; set; }
+        
+        public bool isExceedingLimit()
+        {
+            if (customer != null)
+            {
+                Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(customer));
+                
+                double dARate = 0.3;
+                double dSRate = 0.05;
+                if (customer.ARate != null)
+                {
+                    dARate = Convert.ToDouble(customer.ARate) / 100.00;
+                }
+
+                if (customer.SRate != null)
+                {
+                    dSRate = Convert.ToDouble(customer.SRate) / 100.00;
+                }
+
+                
+                if (Totals > 0)
+                {
+                    if (Convert.ToDouble(ACount) / Convert.ToDouble(Totals) > dARate ||
+                            Convert.ToDouble(SCount) / Convert.ToDouble(Totals) > dSRate)
+                    {
+                        return true;
+                    }
+
+                }
+
+            }
+
+            return false;
+        }
+    }
+}

+ 4 - 0
wospro.sp.entity/Customer.cs

@@ -24,6 +24,10 @@ namespace wispro.sp.entity
 
         public virtual Staff ResponseMan { get; set; }
 
+        public int? ARate { get; set; }
+
+        public int? SRate { get; set; }
+
         [JsonIgnore]
         public virtual ICollection<PerformanceItem> PerformanceItems { get; set; } = new List<PerformanceItem>();
     }