Commit d77d6822 by 李承祥

二次绩效配置添加科室,二次绩效录入顶部数据补充

parent c1e8bf54
......@@ -57,7 +57,7 @@ public ApiResponse SaveValue([FromBody]List<ag_fixatitem> request)
throw new PerformanceException("二次绩效ID错误");
var typeCount = request.Where(t => t.Type > 0).Select(t => t.Type).Distinct().Count();
if (typeCount != 1 || request.Any(t => t.Type == 0))
if (request.Any(t => t.Type == 0)) //typeCount != 1 ||
throw new PerformanceException("二次绩效项位置错误");
var unitTypeCount = request.Where(t => !string.IsNullOrEmpty(t.UnitType)).Select(t => t.UnitType).Distinct().Count();
......
......@@ -1038,6 +1038,11 @@
</summary>
</member>
<member name="P:Performance.DtoModels.CofAgainRequest.Department">
<summary>
科室
</summary>
</member>
<member name="P:Performance.DtoModels.CofAgainRequest.Type">
<summary>
1 职称绩效 2 工作量绩效 3 满勤天数
......
......@@ -934,6 +934,11 @@
</summary>
</member>
<member name="P:Performance.EntityModels.cof_again.Department">
<summary>
科室
</summary>
</member>
<member name="P:Performance.EntityModels.cof_again.Type">
<summary>
1 职称绩效 2 工作量绩效 3 满勤天数
......
......@@ -13,6 +13,11 @@ public class CofAgainRequest
public int AllotID { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 1 职称绩效 2 工作量绩效 3 满勤天数
/// </summary>
public int Type { get; set; }
......
......@@ -27,6 +27,11 @@ public class cof_again
public Nullable<int> AllotID { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 1 职称绩效 2 工作量绩效 3 满勤天数
/// </summary>
public Nullable<int> Type { get; set; }
......
......@@ -495,7 +495,7 @@ public void Copy(per_allot allot)
if (data == null || data.Count == 0)
{
var again = _againRepository.GetEntities(t => t.AllotID == allotId) ?? _againRepository.GetEntities(t => t.AllotID == -1);
var newAgains = again.Select(t => new cof_again { AllotID = allot.ID, Type = t.Type, TypeName = t.TypeName, Value = t.Value });
var newAgains = again.Select(t => new cof_again { AllotID = allot.ID, Type = t.Type, Department = t.Department, TypeName = t.TypeName, Value = t.Value });
_againRepository.AddRange(newAgains.ToArray());
}
}
......@@ -537,6 +537,7 @@ public cof_again AgainUpdate(CofAgainRequest request)
throw new PerformanceException($"ID不存在 :{request.ID}");
again.Type = request.Type;
again.Department = request.Department;
again.TypeName = request.TypeName;
again.Value = request.Value;
......
......@@ -26,6 +26,7 @@ public class SecondAllotService : IAutoInjection
private readonly PerforAgfixatitemRepository perforAgfixatitemRepository;
private readonly PerforAgusetempRepository perforAgusetempRepository;
private readonly PerforAgcomputeRepository perforAgcomputeRepository;
private readonly PerforCofagainRepository perforCofagainRepository;
public SecondAllotService(IOptions<Application> application,
PerforUserRepository perforUserRepository,
......@@ -39,7 +40,8 @@ public class SecondAllotService : IAutoInjection
PerforAgtempitemRepository perforAgtempitemRepository,
PerforAgfixatitemRepository perforAgfixatitemRepository,
PerforAgusetempRepository perforAgusetempRepository,
PerforAgcomputeRepository perforAgcomputeRepository)
PerforAgcomputeRepository perforAgcomputeRepository,
PerforCofagainRepository perforCofagainRepository)
{
this.application = application.Value;
this.perforUserRepository = perforUserRepository;
......@@ -54,6 +56,7 @@ public class SecondAllotService : IAutoInjection
this.perforAgfixatitemRepository = perforAgfixatitemRepository;
this.perforAgusetempRepository = perforAgusetempRepository;
this.perforAgcomputeRepository = perforAgcomputeRepository;
this.perforCofagainRepository = perforCofagainRepository;
}
/// <summary>
......@@ -368,13 +371,14 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
var result = new SecondResponse { HeadItems = headItems, BodyItems = new List<BodyItem>() };
//获取数据
var fixatList = perforAgfixatitemRepository.GetEntities(t => t.SecondId == request.SecondId && t.RowNumber.HasValue);
if (fixatList != null || fixatList.Count > 0)
if (fixatList != null && fixatList.Count > 0)
{
//补充数据
var rows = fixatList.Select(t => t.RowNumber.Value).Distinct();
foreach (var row in rows)
{
foreach (var item in headItems)
var header = row == -1 ? headItems.Where(t => t.Type == 1).ToList() : headItems.Where(t => t.Type != 1).ToList();
foreach (var item in header)
{
var bodyItem = new BodyItem
{
......@@ -391,6 +395,28 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
}
}
}
else
{
var second = perforAgsecondallotRepository.GetEntity(t => t.Id == request.SecondId);
var config = perforCofagainRepository.GetEntities(t => t.AllotID == second.AllotId && t.Department == request.Department) ?? new List<cof_again>();
config.Add(new cof_again { TypeName = "绩效合计(考核后)", Value = second.RealGiveFee });
foreach (var item in headItems.Where(t => t.Type == 1))
{
var bodyItem = new BodyItem
{
RowNumber = -1,
FiledId = item.FiledId,
FiledName = item.FiledName,
FactorValue = item.FactorValue,
SourceType = item.SourceType,
Type = item.Type,
Sort = item.Sort,
Value = config.FirstOrDefault(t => t.TypeName == item.FiledName)?.Value.ToString()
};
result.BodyItems.Add(bodyItem);
}
result.BodyItems.FirstOrDefault(t => t.FiledName == "发放月份").Value = $"{second.Year}{second.Month}月";
}
return result;
}
}
......
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