BUG修复特殊科室及全院人均绩效

parent d2dfcd02
......@@ -214,29 +214,30 @@ public ApiResponse AllComputeAvg([FromBody] ComputerRequest request)
throw new PerformanceException("当前绩效记录不存在");
var isShowManage = _computeService.IsShowManage(request.AllotId);
var list = _computeService.AllCompute(request.AllotId, isShowManage);
List<res_baiscnorm> avgs = _computeService.AllComputeAvg(request.AllotId,list);
List<res_baiscnorm> avgs = new List<res_baiscnorm>();
//List<res_baiscnorm> avgs = new List<res_baiscnorm>();
var gc = list.Where(w => w.UnitType != UnitType.行政高层.ToString());
//var gc = list.Where(w => w.UnitType != UnitType.行政高层.ToString());
avgs.Add(new res_baiscnorm
{
PositionName = "不含行政高层人均绩效",
TotelNumber = gc.Select(w => new { w.JobNumber, w.EmployeeName }).Distinct().Count(),
TotelValue = Math.Round(gc.Sum(s => s.RealGiveFee) ?? 0),
AvgValue = gc.Select(p => new { p.JobNumber, p.EmployeeName }).Distinct().Count() == 0
? 0 : Math.Round(gc.Sum(s => s.RealGiveFee) / gc.Select(p => new { p.JobNumber, p.EmployeeName }).Distinct().Count() ?? 0)
});
//avgs.Add(new res_baiscnorm
//{
// PositionName = "不含行政高层人均绩效",
// TotelNumber = gc.Select(w => new { w.JobNumber, w.EmployeeName }).Distinct().Count(),
// TotelValue = Math.Round(gc.Sum(s => s.RealGiveFee) ?? 0),
// AvgValue = gc.Select(p => new { p.JobNumber, p.EmployeeName }).Distinct().Count() == 0
// ? 0 : Math.Round(gc.Sum(s => s.RealGiveFee) / gc.Select(p => new { p.JobNumber, p.EmployeeName }).Distinct().Count() ?? 0)
//});
avgs.AddRange(
list.GroupBy(w => w.UnitType).Select(w => new res_baiscnorm
{
PositionName = $"{w.Key}人均绩效",
TotelNumber = w.Count(),
TotelValue = Math.Round(w.Sum(s => s.RealGiveFee) ?? 0),
AvgValue = gc.Select(p => new { p.JobNumber, p.EmployeeName }).Distinct().Count() == 0
? 0 : Math.Round(gc.Sum(s => s.RealGiveFee) / gc.Select(p => new { p.JobNumber, p.EmployeeName }).Distinct().Count() ?? 0)
}));
//avgs.AddRange(
// list.GroupBy(w => w.UnitType).Select(w => new res_baiscnorm
// {
// PositionName = $"{w.Key}人均绩效",
// TotelNumber = w.Count(),
// TotelValue = Math.Round(w.Sum(s => s.RealGiveFee) ?? 0),
// AvgValue = gc.Select(p => new { p.JobNumber, p.EmployeeName }).Distinct().Count() == 0
// ? 0 : Math.Round(gc.Sum(s => s.RealGiveFee) / gc.Select(p => new { p.JobNumber, p.EmployeeName }).Distinct().Count() ?? 0)
// }));
return new ApiResponse(ResponseType.OK, "ok", avgs.Select(w => new { w.PositionName, w.TotelNumber, w.TotelValue, w.AvgValue }));
}
......
......@@ -258,7 +258,7 @@ public class ResultComputeService : IAutoInjection
//应发管理绩效
compute.ShouldGiveFee = Math.Round((compute.Efficiency + compute.Scale) * compute.Grant ?? 0);
//绩效合计
compute.PerforSumFee = Math.Round(compute.Avg + compute.ShouldGiveFee + compute.AssessBeforeOtherFee ?? 0);
compute.PerforSumFee = Math.Round(compute.Avg * (empolyee.Basics ?? 0) + compute.ShouldGiveFee + compute.AssessBeforeOtherFee ?? 0);
//应发绩效
//compute.GiveFee = compute.PerforSumFee;
compute.GiveFee = Math.Round(compute.PerforSumFee * compute.ScoreAverageRate * compute.Attendance + compute.Punishment + compute.AssessLaterOtherFee ?? 0);
......
......@@ -208,6 +208,29 @@ public List<ResComputeResponse> GetCompute(int allotId, int type)
}
}
public List<res_baiscnorm> AllComputeAvg(int allotId, List<ComputeResponse> list)
{
List<res_baiscnorm> avgs = new List<res_baiscnorm>();
var emps = perforPeremployeeRepository.GetEntities(w => w.AllotId == allotId);
var jobCategory = emps.Select(w => string.IsNullOrEmpty(w.JobCategory) ? "未知" : w.JobCategory).Distinct();
foreach (var item in jobCategory)
{
var sumfee = (from com in list
join emp in emps.Where(w => w.JobCategory == item)
on com.JobNumber equals emp.PersonnelNumber
select com.ShouldGiveFee).Sum(w => w);
var count = emps.Where(w => w.JobCategory == item).Select(emp => emp.PersonnelNumber).Distinct().Count();
avgs.Add(new res_baiscnorm
{
PositionName = item,
TotelNumber = count,
TotelValue = sumfee,
AvgValue = count == 0 ? 0 : sumfee / count,
});
}
return avgs;
}
/// <summary>
/// 返回特殊科室发放列表
/// </summary>
......
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