Commit 0d417378 by ruyun.zhang@suvalue.com

Merge branch 'feature/二次分配格式验证' into develop

parents 08b3652d fb8bf243
...@@ -613,9 +613,10 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request) ...@@ -613,9 +613,10 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request)
throw new PerformanceException("绩效记录不存在!"); throw new PerformanceException("绩效记录不存在!");
// 年资职称绩效占比与工作量绩效占比 校验 // 年资职称绩效占比与工作量绩效占比 校验
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate) if ((ComputeMode)request.ComputeMode != ComputeMode.NotCalculate)
{ {
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
var workloadRatio = workloadGroups.Select(w => request.Head.GetValue($"Workload_Ratio_{w.Name}", 0m)); var workloadRatio = workloadGroups.Select(w => request.Head.GetValue($"Workload_Ratio_{w.Name}", 0m));
if (workloadRatio.Any(w => w > 1 || w < 0)) if (workloadRatio.Any(w => w > 1 || w < 0))
throw new PerformanceException("工作量绩效占比存在异常值!"); throw new PerformanceException("工作量绩效占比存在异常值!");
...@@ -629,8 +630,20 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request) ...@@ -629,8 +630,20 @@ public ApiResponse RedistributionCheck([FromBody] SecondComputeDto request)
else if (seniorityTitlesAccountedPerformance + workloadRatio.Sum() < 1) else if (seniorityTitlesAccountedPerformance + workloadRatio.Sum() < 1)
throw new PerformanceException("年资职称绩效占比与工作量绩效占比总和,不足100%!"); throw new PerformanceException("年资职称绩效占比与工作量绩效占比总和,不足100%!");
} }
List<SecondComputeCheckResultDto> result = new List<SecondComputeCheckResultDto>();
// 二次分配人员信息 校验 // 二次分配人员信息 校验
var result = _redistributionService.CheckData(second, (ComputeMode)request.ComputeMode, request.Body, loads); var checkData = _redistributionService.CheckData(second, (ComputeMode)request.ComputeMode, request.Body, loads);
if (checkData != null && checkData.Count > 0)
result.AddRange(checkData);
// 二次分配提交数据格式 校验
var dic = _redistributionService.GetTableHeaderDictionary((ComputeMode)request.ComputeMode, allot, second, loads, workloadGroups);
var checkFormat = _redistributionService.CheckFormat(request.Head, request.Body, dic);
if (checkFormat != null && checkFormat.Count > 0)
result.AddRange(checkFormat);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
catch (PerformanceException ex) catch (PerformanceException ex)
...@@ -737,10 +750,16 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request) ...@@ -737,10 +750,16 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request)
throw new PerformanceException("绩效记录不存在!"); throw new PerformanceException("绩效记录不存在!");
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
// 二次分配人员信息 校验 // 二次分配人员信息 校验
var checkDatas = _redistributionService.CheckData(second, (ComputeMode)request.ComputeMode, request.Body, loads); var checkDatas = _redistributionService.CheckData(second, (ComputeMode)request.ComputeMode, request.Body, loads);
if (checkDatas != null && checkDatas.Any(w => w.Level == ResponseType.Error.ToString())) if (checkDatas != null && checkDatas.Any(w => w.Level == ResponseType.Error.ToString()))
return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkDatas.Where(w => w.Level == ResponseType.Error.ToString())); return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkDatas.Where(w => w.Level == ResponseType.Error.ToString()));
// 二次分配提交数据格式 校验
var dic = _redistributionService.GetTableHeaderDictionary((ComputeMode)request.ComputeMode, allot, second, loads, workloadGroups);
var checkFormat = _redistributionService.CheckFormat(request.Head, request.Body, dic);
if (checkFormat != null && checkFormat.Any(w => w.Level == ResponseType.Error.ToString()))
return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkFormat.Where(w => w.Level == ResponseType.Error.ToString()));
// 清理无效数据 没有Tab标签的数据才是要计算的数据 // 清理无效数据 没有Tab标签的数据才是要计算的数据
var cleanDatas = request.Body.Where(w => w.Count > 0 && w.GetValue(nameof(ResponseType), "") == ResponseType.OK.ToString()).ToList(); var cleanDatas = request.Body.Where(w => w.Count > 0 && w.GetValue(nameof(ResponseType), "") == ResponseType.OK.ToString()).ToList();
...@@ -786,11 +805,19 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request) ...@@ -786,11 +805,19 @@ public ApiResponse RedistributionSubmit([FromBody] SecondComputeDto request)
throw new PerformanceException("绩效未下发,无法提交!"); throw new PerformanceException("绩效未下发,无法提交!");
var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department); var loads = _redistributionService.GetWorkLoads(allot.HospitalId, second.UnitType, second.Department);
var workloadGroups = _redistributionService.GetTopWorkloadBodyGroups(loads);
// 二次分配人员信息 校验 // 二次分配人员信息 校验
var checkDatas = _redistributionService.CheckData(second, (ComputeMode)request.ComputeMode, request.Body, loads); var checkDatas = _redistributionService.CheckData(second, (ComputeMode)request.ComputeMode, request.Body, loads);
if (checkDatas != null && checkDatas.Any(w => w.Level == ResponseType.Error.ToString())) if (checkDatas != null && checkDatas.Any(w => w.Level == ResponseType.Error.ToString()))
return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkDatas.Where(w => w.Level == ResponseType.Error.ToString())); return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkDatas.Where(w => w.Level == ResponseType.Error.ToString()));
// 二次分配提交数据格式 校验
var dic = _redistributionService.GetTableHeaderDictionary((ComputeMode)request.ComputeMode, allot, second, loads, workloadGroups);
var checkFormat = _redistributionService.CheckFormat(request.Head, request.Body, dic);
if (checkFormat != null && checkFormat.Any(w => w.Level == ResponseType.Error.ToString()))
return new ApiResponse(ResponseType.Fail, "数据验证未通过,请修复后查看计算结果!", checkFormat.Where(w => w.Level == ResponseType.Error.ToString()));
// 清理无效数据 没有Tab标签的数据才是要计算的数据 // 清理无效数据 没有Tab标签的数据才是要计算的数据
var cleanDatas = request.Body.Where(w => w.Count > 0 && w.GetValue(nameof(ResponseType), "") == ResponseType.OK.ToString()).ToList(); var cleanDatas = request.Body.Where(w => w.Count > 0 && w.GetValue(nameof(ResponseType), "") == ResponseType.OK.ToString()).ToList();
if (cleanDatas == null || cleanDatas.Count == 0) if (cleanDatas == null || cleanDatas.Count == 0)
......
...@@ -4108,6 +4108,11 @@ ...@@ -4108,6 +4108,11 @@
颜色class名称 颜色class名称
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.SecondColumnDictionary.IsNumber">
<summary>
格式
</summary>
</member>
<member name="P:Performance.DtoModels.SecondEmployeeDto.ComputeMode"> <member name="P:Performance.DtoModels.SecondEmployeeDto.ComputeMode">
<summary> <summary>
计算方式:11 不计算 12 横向计算 13 纵向计算 计算方式:11 不计算 12 横向计算 13 纵向计算
......
...@@ -34,12 +34,16 @@ public class SecondColumnDictionary ...@@ -34,12 +34,16 @@ public class SecondColumnDictionary
/// 颜色class名称 /// 颜色class名称
/// </summary> /// </summary>
public string Color { get; set; } public string Color { get; set; }
/// <summary>
/// 格式
/// </summary>
public bool IsNumber { get; set; }
public SecondColumnDictionary() public SecondColumnDictionary()
{ {
} }
public SecondColumnDictionary(string label, string key, bool isTrue, int sort, string site = "Table", string type = "", string color = "", int? width = null) public SecondColumnDictionary(string label, string key, bool isTrue, int sort, string site = "Table", string type = "", string color = "", int? width = null, bool isNumber = true)
{ {
Label = label; Label = label;
Key = key; Key = key;
...@@ -49,6 +53,7 @@ public SecondColumnDictionary(string label, string key, bool isTrue, int sort, s ...@@ -49,6 +53,7 @@ public SecondColumnDictionary(string label, string key, bool isTrue, int sort, s
Type = type; Type = type;
Color = color; Color = color;
Width = width.HasValue ? width.ToString() : ((label ?? "").Length * 20 + 10).ToString(); Width = width.HasValue ? width.ToString() : ((label ?? "").Length * 20 + 10).ToString();
IsNumber = isNumber;
} }
} }
} }
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