Commit 8e69766d by 李承祥

全员绩效发放

parent c14ecb96
......@@ -34,13 +34,13 @@ public class ComputeController : Controller
/// <returns></returns>
[Route("getcompute")]
[HttpPost]
public ApiResponse<List<res_compute>> GetCompute([CustomizeValidator(RuleSet = "Select"), FromBody]ComputerRequest request)
public ApiResponse GetCompute([CustomizeValidator(RuleSet = "Select"), FromBody]ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _computeService.GetCompute(request.AllotId, request.Type);
return new ApiResponse<List<res_compute>>(ResponseType.OK, "ok", list);
return new ApiResponse(ResponseType.OK, "ok", list);
}
/// <summary>
......@@ -107,5 +107,21 @@ public ApiResponse<DeptDetailResponse> DeptDetail([FromBody]DeptDetailRequest re
DeptDetailResponse response = _computeService.GetDepartmentDetail(request);
return new ApiResponse<DeptDetailResponse>(ResponseType.OK, response);
}
/// <summary>
/// 获取全院绩效列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("allcompute")]
[HttpPost]
public ApiResponse AllCompute([FromBody]ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _computeService.AllCompute(request.AllotId);
return new ApiResponse(ResponseType.OK, "ok", list);
}
}
}
\ No newline at end of file
......@@ -125,6 +125,7 @@ public AutoMapperConfigs()
CreateMap<ag_againsituation, PerAgainSituation>();
CreateMap<per_againallot, AgainAllotResponse>();
CreateMap<res_compute, ComputeResponse>();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class ComputeResponse
{
/// <summary>
/// 来源
/// </summary>
public string Source { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 人员名称
/// </summary>
public string EmployeeName { get; set; }
/// <summary>
/// 职位
/// </summary>
public string JobTitle { get; set; }
/// <summary>
/// 实发绩效
/// </summary>
public Nullable<decimal> RealGiveFee { get; set; }
}
}
......@@ -18,12 +18,18 @@ public class ComputeService : IAutoInjection
private PerforImdataRepository _perforImDataRepository;
private PerforRescomputeRepository _perforRescomputeRepository;
private PerforResspecialunitRepository _perforResspecialunitRepository;
private PerforPeragainallotRepository _perforPeragainallotRepository;
private PerforUserRepository _perforUserRepository;
private PerforAgemployeeRepository _perforAgemployeeRepository;
public ComputeService(PerforResaccountdoctorRepository perforResAccountdoctorRepository,
PerforResaccountnurseRepository perforResAccountnurseRepository,
PerforPersheetRepository perforPerSheetRepository,
PerforImdataRepository perforImDataRepository,
PerforRescomputeRepository perforRescomputeRepository,
PerforResspecialunitRepository perforResspecialunitRepository)
PerforResspecialunitRepository perforResspecialunitRepository,
PerforPeragainallotRepository perforPeragainallotRepository,
PerforUserRepository perforUserRepository,
PerforAgemployeeRepository perforAgemployeeRepository)
{
_perforResAccountdoctorRepository = perforResAccountdoctorRepository;
_perforResAccountnurseRepository = perforResAccountnurseRepository;
......@@ -31,6 +37,9 @@ public class ComputeService : IAutoInjection
_perforImDataRepository = perforImDataRepository;
_perforRescomputeRepository = perforRescomputeRepository;
_perforResspecialunitRepository = perforResspecialunitRepository;
_perforPeragainallotRepository = perforPeragainallotRepository;
_perforUserRepository = perforUserRepository;
_perforAgemployeeRepository = perforAgemployeeRepository;
}
/// <summary>
......@@ -57,11 +66,6 @@ public List<res_compute> GetCompute(int allotId, int type)
list = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && conList.Contains(t.FitPeople))
.OrderBy(t => t.AccountingUnit).ThenBy(t => t.FitPeople).ToList();
}
else if (type == 99)
{
list = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId)
.OrderByDescending(t => t.AccountingUnit).ThenBy(t => t.FitPeople).ToList();
}
else
{
throw new PerformanceException("参数错误,type无效");
......@@ -169,5 +173,40 @@ public DeptDetailResponse GetDepartmentDetail(DeptDetailRequest request)
return null;
}
/// <summary>
/// 返回绩效发放列表
/// </summary>
/// <param name="allotId">绩效ID</param>
/// <returns></returns>
public List<ComputeResponse> AllCompute(int allotId)
{
var list = new List<ComputeResponse>();
var allot = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId);
list = Mapper.Map<List<ComputeResponse>>(allot);
list?.ForEach(t => t.Source = "一次绩效");
var employee = _perforAgemployeeRepository.GetEntities(t => t.AllotID == allotId);
if (employee != null && employee.Count > 0)
{
var again = _perforPeragainallotRepository.GetEntities(t => employee.Select(e => e.AgainAllotID).Contains(t.ID));
if (again != null)
{
var data = _perforUserRepository.GetEntities(t => again.Select(a => a.CreateUser).Contains(t.ID) && t.States == 1);
var list1 = from e in employee
join a in again on e.AgainAllotID equals a.ID
join user in data on a.CreateUser equals user.ID
select new ComputeResponse
{
Source = "二次绩效",
AccountingUnit = a.Department,
EmployeeName = user.RealName,
JobTitle = e.JobTitle,
RealGiveFee = e.RealGiveFee
};
list = list.Union(list1.OrderBy(t => t.AccountingUnit)).ToList();
}
}
return list;
}
}
}
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