年资职称绩效占比与工作量绩效占比异常值验证

parent 33a5c19d
...@@ -602,11 +602,17 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request) ...@@ -602,11 +602,17 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request)
if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate) if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate)
{ {
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads); var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
var workloadRatio = workloadGroups.Select(w => request.Head.GetValue($"Workload_Ratio_{w.Name}", 0m));
if (workloadRatio.Any(w => w > 1 || w < 0))
throw new PerformanceException("工作量绩效占比存在异常值!");
var seniorityTitlesAccountedPerformance = request.Head.GetValue(nameof(ag_headsource.SeniorityTitlesAccountedPerformance), 0m); var seniorityTitlesAccountedPerformance = request.Head.GetValue(nameof(ag_headsource.SeniorityTitlesAccountedPerformance), 0m);
var workloadRatio = workloadGroups.Sum(w => request.Head.GetValue($"Workload_Ratio_{w.Name}", 0m)); if (seniorityTitlesAccountedPerformance > 1 || seniorityTitlesAccountedPerformance < 0)
if (seniorityTitlesAccountedPerformance + workloadRatio > 1) throw new PerformanceException("年资职称绩效占比值异常!");
if (seniorityTitlesAccountedPerformance + workloadRatio.Sum() > 1)
throw new PerformanceException("年资职称绩效占比与工作量绩效占比总和,超过100%!"); throw new PerformanceException("年资职称绩效占比与工作量绩效占比总和,超过100%!");
else if (seniorityTitlesAccountedPerformance + workloadRatio < 1) else if (seniorityTitlesAccountedPerformance + workloadRatio.Sum() < 1)
throw new PerformanceException("年资职称绩效占比与工作量绩效占比总和,不足100%!"); throw new PerformanceException("年资职称绩效占比与工作量绩效占比总和,不足100%!");
} }
// 二次分配人员信息 校验 // 二次分配人员信息 校验
...@@ -653,11 +659,17 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request) ...@@ -653,11 +659,17 @@ public ApiResponse RedistributionCompute([FromBody] SecondComputeDto request)
if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate) if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate)
{ {
var workloadRatio = workloadGroups.Select(w => request.Head.GetValue($"Workload_Ratio_{w.Name}", 0m));
if (workloadRatio.Any(w => w > 1 || w < 0))
throw new PerformanceException("工作量绩效占比存在异常值!");
var seniorityTitlesAccountedPerformance = request.Head.GetValue(nameof(ag_headsource.SeniorityTitlesAccountedPerformance), 0m); var seniorityTitlesAccountedPerformance = request.Head.GetValue(nameof(ag_headsource.SeniorityTitlesAccountedPerformance), 0m);
var workloadRatio = workloadGroups.Sum(w => request.Head.GetValue($"Workload_Ratio_{w.Name}", 0m)); if (seniorityTitlesAccountedPerformance > 1 || seniorityTitlesAccountedPerformance < 0)
if (seniorityTitlesAccountedPerformance + workloadRatio > 1) throw new PerformanceException("年资职称绩效占比值异常!");
if (seniorityTitlesAccountedPerformance + workloadRatio.Sum() > 1)
throw new PerformanceException("年资职称绩效占比与工作量绩效占比总和,超过100%!"); throw new PerformanceException("年资职称绩效占比与工作量绩效占比总和,超过100%!");
else if (seniorityTitlesAccountedPerformance + workloadRatio < 1) else if (seniorityTitlesAccountedPerformance + workloadRatio.Sum() < 1)
throw new PerformanceException("年资职称绩效占比与工作量绩效占比总和,不足100%!"); throw new PerformanceException("年资职称绩效占比与工作量绩效占比总和,不足100%!");
} }
......
...@@ -25,5 +25,15 @@ public static bool IsOffice(string unit) ...@@ -25,5 +25,15 @@ public static bool IsOffice(string unit)
{ {
return !string.IsNullOrEmpty(unit) && (unit == "行政后勤" || unit == "行政工勤"); return !string.IsNullOrEmpty(unit) && (unit == "行政后勤" || unit == "行政工勤");
} }
/// <summary>
/// 核算单元类型是否相同
/// </summary>
/// <param name="left"></param>
/// <returns></returns>
public static bool IsEqualsUnitType(string left, string right)
{
return left?.Replace("行政后勤", "行政工勤") == right?.Replace("行政后勤", "行政工勤");
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment