渝北院领导计算 代码丢失找回

parent e6ede3ac
...@@ -217,6 +217,15 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody] A ...@@ -217,6 +217,15 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody] A
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
[Route("recalculation")]
[HttpPost]
public ApiResponse Recalculation([FromBody] RecalculationRequest request)
{
if (request.Money.HasValue && request.Money.Value > 0)
_allotService.Recalculation(request.AllotId, request.Money.Value);
return new ApiResponse(ResponseType.OK);
}
/// <summary> /// <summary>
/// 归档绩效记录 /// 归档绩效记录
/// </summary> /// </summary>
......
namespace Performance.DtoModels
{
public class RecalculationRequest
{
public int AllotId { get; set; }
public decimal? Money { get; set; }
}
}
...@@ -33,6 +33,9 @@ public class AllotService : IAutoInjection ...@@ -33,6 +33,9 @@ public class AllotService : IAutoInjection
private PerforPerallotRepository _allotRepository; private PerforPerallotRepository _allotRepository;
private IEmailService emailService; private IEmailService emailService;
private readonly IOptions<Application> options; private readonly IOptions<Application> options;
private readonly ComputeDirector _computeDirector;
private readonly PerforRescomputeRepository _perforRescomputeRepository;
private readonly PerforImemployeeRepository _perforImEmployeeRepository;
private PerforPeragainallotRepository _againallotRepository; private PerforPeragainallotRepository _againallotRepository;
private PerforLogcheckRepository perforLogcheckRepository; private PerforLogcheckRepository perforLogcheckRepository;
private readonly PerforHospitalRepository perforHospitalRepository; private readonly PerforHospitalRepository perforHospitalRepository;
...@@ -60,6 +63,9 @@ public class AllotService : IAutoInjection ...@@ -60,6 +63,9 @@ public class AllotService : IAutoInjection
IHostingEnvironment evn, ILogger<AllotService> logger, IHostingEnvironment evn, ILogger<AllotService> logger,
IEmailService emailService, IEmailService emailService,
IOptions<Application> options, IOptions<Application> options,
ComputeDirector computeDirector,
PerforRescomputeRepository perforRescomputeRepository,
PerforImemployeeRepository perforImEmployeeRepository,
PerforPeragainallotRepository againallotRepository, PerforPeragainallotRepository againallotRepository,
PerforLogcheckRepository perforLogcheckRepository, PerforLogcheckRepository perforLogcheckRepository,
PerforHospitalRepository perforHospitalRepository, PerforHospitalRepository perforHospitalRepository,
...@@ -84,6 +90,9 @@ public class AllotService : IAutoInjection ...@@ -84,6 +90,9 @@ public class AllotService : IAutoInjection
this.resultComputeService = resultComputeService; this.resultComputeService = resultComputeService;
this.emailService = emailService; this.emailService = emailService;
this.options = options; this.options = options;
_computeDirector = computeDirector;
_perforRescomputeRepository = perforRescomputeRepository;
_perforImEmployeeRepository = perforImEmployeeRepository;
this.configService = configService; this.configService = configService;
this.logdbug = logdbug; this.logdbug = logdbug;
this.perforresreservedRepository = perforresreservedRepository; this.perforresreservedRepository = perforresreservedRepository;
...@@ -453,6 +462,39 @@ public void Generate(per_allot allot, string mail) ...@@ -453,6 +462,39 @@ public void Generate(per_allot allot, string mail)
} }
} }
public void Recalculation(int allotId, decimal money)
{
var allot = _allotRepository.GetEntity(w => w.ID == allotId);
var empolyeeList = _perforImEmployeeRepository.GetEntities(t => t.AllotID == allotId && t.AccountType == AccountUnitType.行政高层.ToString());
if (empolyeeList == null) return;
var computeEmployees = Mapper.Map<List<ComputeEmployee>>(empolyeeList);
computeEmployees.ForEach(w => w.FitPeopleValue = money);
List<res_baiscnorm> baiscnormList = new List<res_baiscnorm>();
var computResult = _computeDirector.Compute(computeEmployees, allot, baiscnormList);
if (computResult == null) return;
baiscnormList = baiscNormService.ComputeOtherAvg(baiscnormList, computResult, empolyeeList);
var historyRescompute = _perforRescomputeRepository.GetEntities(w => w.AllotID == allotId && w.AccountType == AccountUnitType.行政高层.ToString());
if (historyRescompute != null && historyRescompute.Any())
_perforRescomputeRepository.RemoveRange(historyRescompute.ToArray());
var computes = Mapper.Map<List<res_compute>>(computResult);
computes.ForEach(t => t.AllotID = allot.ID);
_perforRescomputeRepository.AddRange(computes.ToArray());
var names = baiscnormList.Select(b => b.PositionName).ToList();
var historyResbaiscnorm = perforResbaiscnormRepository.GetEntities(w => w.AllotID == allotId && names.Contains(w.PositionName));
if (historyResbaiscnorm != null && historyResbaiscnorm.Any())
perforResbaiscnormRepository.RemoveRange(historyResbaiscnorm.ToArray());
perforResbaiscnormRepository.AddRange(Mapper.Map<res_baiscnorm[]>(baiscnormList));
}
/// <summary> /// <summary>
/// 发送邮件 /// 发送邮件
/// </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