行政科室二次分配人员带出逻辑修改

parent 79e03c5e
using AutoMapper; using AutoMapper;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.DtoModels.AppSettings;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.Infrastructure; using Performance.Infrastructure;
using Performance.Repository; using Performance.Repository;
...@@ -14,6 +16,8 @@ namespace Performance.Services ...@@ -14,6 +16,8 @@ namespace Performance.Services
public class SecondAllotDetails : IAutoInjection public class SecondAllotDetails : IAutoInjection
{ {
private readonly ILogger<SecondAllotDetails> _logger; private readonly ILogger<SecondAllotDetails> _logger;
private readonly PerforImemployeelogisticsRepository _imemployeelogisticsRepository;
private readonly Application _application;
private readonly PerforAgsecondallotRepository agsecondallotRepository; private readonly PerforAgsecondallotRepository agsecondallotRepository;
private readonly PerforAgusetempRepository agusetempRepository; private readonly PerforAgusetempRepository agusetempRepository;
private readonly PerforAgtempitemRepository agtempitemRepository; private readonly PerforAgtempitemRepository agtempitemRepository;
...@@ -26,9 +30,12 @@ public class SecondAllotDetails : IAutoInjection ...@@ -26,9 +30,12 @@ public class SecondAllotDetails : IAutoInjection
private readonly PerforPerapramountRepository perapramountRepository; private readonly PerforPerapramountRepository perapramountRepository;
private readonly PerforRescomputeRepository rescomputeRepository; private readonly PerforRescomputeRepository rescomputeRepository;
private readonly PersonService personService; private readonly PersonService personService;
private readonly UserService _userService;
public SecondAllotDetails( public SecondAllotDetails(
ILogger<SecondAllotDetails> logger, ILogger<SecondAllotDetails> logger,
IOptions<Application> application,
PerforImemployeelogisticsRepository imemployeelogisticsRepository,
PerforAgsecondallotRepository agsecondallotRepository, PerforAgsecondallotRepository agsecondallotRepository,
PerforAgusetempRepository agusetempRepository, PerforAgusetempRepository agusetempRepository,
PerforAgtempitemRepository agtempitemRepository, PerforAgtempitemRepository agtempitemRepository,
...@@ -40,10 +47,13 @@ public class SecondAllotDetails : IAutoInjection ...@@ -40,10 +47,13 @@ public class SecondAllotDetails : IAutoInjection
PerforCofagainRepository cofagainRepository, PerforCofagainRepository cofagainRepository,
PerforPerapramountRepository perapramountRepository, PerforPerapramountRepository perapramountRepository,
PerforRescomputeRepository rescomputeRepository, PerforRescomputeRepository rescomputeRepository,
PersonService personService PersonService personService,
UserService userService
) )
{ {
_logger = logger; _logger = logger;
_imemployeelogisticsRepository = imemployeelogisticsRepository;
_application = application.Value;
this.agsecondallotRepository = agsecondallotRepository; this.agsecondallotRepository = agsecondallotRepository;
this.agusetempRepository = agusetempRepository; this.agusetempRepository = agusetempRepository;
this.agtempitemRepository = agtempitemRepository; this.agtempitemRepository = agtempitemRepository;
...@@ -56,6 +66,7 @@ PersonService personService ...@@ -56,6 +66,7 @@ PersonService personService
this.perapramountRepository = perapramountRepository; this.perapramountRepository = perapramountRepository;
this.rescomputeRepository = rescomputeRepository; this.rescomputeRepository = rescomputeRepository;
this.personService = personService; this.personService = personService;
_userService = userService;
} }
#region 横向纵向模板详情 #region 横向纵向模板详情
...@@ -556,6 +567,7 @@ private void SupplyHeaderByWorkItem(int hospitalId, SecondResponse result, ag_se ...@@ -556,6 +567,7 @@ private void SupplyHeaderByWorkItem(int hospitalId, SecondResponse result, ag_se
public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int isArchive, int employeeSource) public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int isArchive, int employeeSource)
{ {
var secondAllot = agsecondallotRepository.GetEntity(t => t.Id == secondId); var secondAllot = agsecondallotRepository.GetEntity(t => t.Id == secondId);
if (secondAllot == null) throw new PerformanceException("二次绩效信息无效!"); if (secondAllot == null) throw new PerformanceException("二次绩效信息无效!");
...@@ -580,6 +592,33 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -580,6 +592,33 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
var employees = personService.GetPersons(secondAllot.AllotId.Value, userId)?.Where(t => t.UnitType == secondAllot.UnitType).ToList(); var employees = personService.GetPersons(secondAllot.AllotId.Value, userId)?.Where(t => t.UnitType == secondAllot.UnitType).ToList();
var role = _userService.GetUserFirstRole(userId);
//行政科室 只有两种逻辑,或从保存中加载,或加载EXCEL表
if (role?.Type == _application.OfficeRole)
{
// 如果已经保存>>走保存加载逻辑
if (employeeSource == (int)EmployeeSource.Initial)
{
result = savedDataList.OrderBy(t => t.Id).ToList();
}
// 如果没保存>>走加载im_employee_logistics人员名单逻辑
else
{
var types = new string[] { "行政后勤", "行政工勤" };
var logistics = _imemployeelogisticsRepository.GetEntities(w => w.AllotID == secondAllot.AllotId && types.Contains(w.AccountType) && w.AccountingUnit == secondAllot.Department);
result = (logistics ?? new List<im_employee_logistics>()).Select(w => new ag_othersource
{
SecondId = secondId,
WorkNumber = w.PersonnelNumber,
Name = w.DoctorName,
Department = w.AccountingUnit,
WorkPost = w.JobTitle,
}).ToList();
}
}
//非行政科室 有三种逻辑,或从保存中加载,或从人员字典加载,或从上次绩效中加载
else
{
switch (employeeSource) switch (employeeSource)
{ {
case (int)EmployeeSource.Initial: case (int)EmployeeSource.Initial:
...@@ -614,11 +653,8 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -614,11 +653,8 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
}).ToList(); }).ToList();
} }
break; break;
default:
break;
} }
}
var originalEmployees = personService.GetPerEmployee(secondAllot.AllotId.Value); var originalEmployees = personService.GetPerEmployee(secondAllot.AllotId.Value);
SupplementSecondDetail(secondAllot, originalEmployees, result, isSupplementTitlePerformance); SupplementSecondDetail(secondAllot, originalEmployees, result, isSupplementTitlePerformance);
...@@ -657,10 +693,17 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em ...@@ -657,10 +693,17 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
item.ReservedRatio = empl.ReservedRatio; item.ReservedRatio = empl.ReservedRatio;
item.OtherPerformance = getAprAmount(empl); item.OtherPerformance = getAprAmount(empl);
if (isTitlePerformance) if (isTitlePerformance)
{
// 如果是行政后勤,则把绩效放在工作量上
if (second.UnitType == UnitType.行政后勤.ToString())
item.WorkPerformance = getDistPerformance(empl);
// 其他人群则把绩效放在职称上
else
item.TitlePerformance = getDistPerformance(empl); item.TitlePerformance = getDistPerformance(empl);
} }
} }
} }
}
#endregion 其他模板详情 #endregion 其他模板详情
......
...@@ -109,6 +109,24 @@ public UserIdentity GetUser(int userId) ...@@ -109,6 +109,24 @@ public UserIdentity GetUser(int userId)
} }
/// <summary> /// <summary>
/// 获取用户第一个角色
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public sys_role GetUserFirstRole(int userId)
{
var user = _userRepository.GetEntity(t => t.ID == userId);
if (user == null)
throw new PerformanceException("用户信息查询失败");
var userrole = _userroleRepository.GetEntity(t => t.UserID == userId);
if (userrole == null)
throw new PerformanceException("角色信息查询失败");
var role = _roleRepository.GetEntity(t => t.ID == userrole.RoleID);
return role;
}
/// <summary>
/// 查询用户列表 /// 查询用户列表
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
......
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