发放表其他绩效合并

parent 50c9fd62
......@@ -32,9 +32,11 @@ public class ComputeService : IAutoInjection
private readonly PerforHospitalRepository hospitalRepository;
private readonly PerforPerapramountRepository perapramountRepository;
private readonly PerforPeremployeeRepository perforPeremployeeRepository;
private readonly PerforPerapramounthideRepository _hideRepository;
private readonly PerforCofworkitemRepository cofworkitemRepository;
public ComputeService(PerforResaccountRepository perforResaccountRepository,
public ComputeService(
PerforResaccountRepository perforResaccountRepository,
PerforPersheetRepository perforPerSheetRepository,
PerforImdataRepository perforImDataRepository,
PerforImheaderRepository perforImheaderRepository,
......@@ -49,6 +51,7 @@ public class ComputeService : IAutoInjection
PerforHospitalRepository hospitalRepository,
PerforPerapramountRepository perapramountRepository,
PerforPeremployeeRepository perforPeremployeeRepository,
PerforPerapramounthideRepository hideRepository,
PerforCofworkitemRepository cofworkitemRepository)
{
this.perforResaccountRepository = perforResaccountRepository;
......@@ -66,6 +69,7 @@ public class ComputeService : IAutoInjection
this.hospitalRepository = hospitalRepository;
this.perapramountRepository = perapramountRepository;
this.perforPeremployeeRepository = perforPeremployeeRepository;
_hideRepository = hideRepository;
this.cofworkitemRepository = cofworkitemRepository;
}
......@@ -589,8 +593,8 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
result.AddRange(officeResult);
// 获取各科室 医院其他绩效
var amounts = perapramountRepository.GetFullAmount(t => t.AllotId == allotId && t.Status == 3);
var otherPerformances = amounts
var fullAmounts = GetTotalAmount(allotId); ;
var otherPerformances = fullAmounts
?.GroupBy(t => new { t.AccountingUnit, t.UnitType })
.Select(t => new view_per_total_amount
{
......@@ -748,7 +752,7 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
// 人员字典
var employees = perforPeremployeeRepository.GetEntities(w => w.AllotId == allotId);
// 获取医院其他绩效汇总结果
var totalAmounts = GetTotalAmount(allotId);
var fullAmounts = GetTotalAmount(allotId);
// 获取一次绩效结果
var one = GetAllotPerformance(allotId, hospitalId, isShowManage);
// 获取二次绩效结果
......@@ -760,6 +764,18 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
if (two != null)
response.AddRange(two);
// 其他绩效汇总
var totalAmounts = fullAmounts
?.GroupBy(w => new { w.AccountingUnit, w.UnitType, w.PersonnelNumber })
.Select(w => new view_per_total_amount
{
AccountingUnit = w.Key.AccountingUnit,
UnitType = w.Key.UnitType,
PersonnelNumber = w.Key.PersonnelNumber,
Amount = w.Sum(t => t.Amount) ?? 0,
Use = false,
})?.ToList();
// 补充医院其他绩效
AddAprAmount(response, totalAmounts);
......@@ -824,26 +840,24 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
}
/// <summary>
/// 获取医院其他绩效汇总结果
/// 合并医院其他绩效、不公示其他绩效
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
private List<view_per_total_amount> GetTotalAmount(int allotId)
private List<view_per_apr_amount> GetTotalAmount(int allotId)
{
var fullAmounts = perapramountRepository.GetFullAmount(t => t.AllotId == allotId && t.Status == 3);
var fullAmounts1 = perapramountRepository.GetFullAmount(t => t.AllotId == allotId && t.Status == 3) ?? new List<view_per_apr_amount>();
var totalAmounts = fullAmounts
?.GroupBy(w => new { w.AccountingUnit, w.UnitType, w.PersonnelNumber })
.Select(w => new view_per_total_amount
{
AccountingUnit = w.Key.AccountingUnit,
UnitType = w.Key.UnitType,
PersonnelNumber = w.Key.PersonnelNumber,
Amount = w.Sum(t => t.Amount) ?? 0,
Use = false,
});
var fullAmounts2 = _hideRepository.GetFullAmount(t => t.AllotId == allotId && t.Status == 3) ?? new List<view_per_apr_amount>();
var fullAmounts = new List<view_per_apr_amount>();
if (fullAmounts1 != null && fullAmounts1.Any())
fullAmounts.AddRange(fullAmounts1);
if (fullAmounts2 != null && fullAmounts2.Any())
fullAmounts.AddRange(fullAmounts2);
return totalAmounts?.ToList() ?? new List<view_per_total_amount>();
return fullAmounts;
}
/// <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