Commit d61a092a by lcx

二次绩效详情返回head数据与模板不同, filedid存在空值

parent 2b497215
......@@ -31,6 +31,7 @@ public class SecondAllotService : IAutoInjection
private readonly PerforCofagainRepository perforCofagainRepository;
private readonly PerforAgothersourceRepository perforAgothersourceRepository;
private readonly PerforRoleRepository roleRepository;
private readonly List<ag_tempitem> tempitems = new List<ag_tempitem>();
public SecondAllotService(IOptions<Application> application,
PerforUserRepository perforUserRepository,
......@@ -65,6 +66,7 @@ public class SecondAllotService : IAutoInjection
this.perforCofagainRepository = perforCofagainRepository;
this.perforAgothersourceRepository = perforAgothersourceRepository;
this.roleRepository = roleRepository;
this.tempitems = perforAgtempitemRepository.GetEntities();
}
#region 二次绩效列表与数据保存
......@@ -264,7 +266,7 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
var fixatList = perforAgfixatitemRepository.GetEntities(t => t.SecondId == request.SecondId && t.RowNumber.HasValue);
//归档 或 等待审核、审核通过时,headItems不会随选择模板改动,带出已填写数据中的headItems
if (request.IsArchive == 1 || (second.Status ?? 1) == 3)
if (request.IsArchive == 1 || new List<int> { 2, 3 }.Contains(second.Status ?? 1))
{
if (fixatList == null || fixatList.Where(t => t.RowNumber != -1).Count() == 0)
throw new PerformanceException("提交时未添加数据。");
......@@ -338,7 +340,8 @@ private List<BodyItem> GetBodyItems(List<ag_fixatitem> fixatitems, List<HeadItem
bodyItems = fixatitems.Select(t => new BodyItem
{
RowNumber = t.RowNumber.Value,
FiledId = headItems.FirstOrDefault(h => h.FiledName == t.ItemName && h.Type == t.Type)?.FiledId ?? $"{t.ItemName}{t.Type}",
FiledId = tempitems.FirstOrDefault(h => h.FiledName == t.ItemName && h.Type == t.Type)?.FiledId ??
headItems.FirstOrDefault(h => h.FiledName == t.ItemName && h.Type == t.Type)?.FiledId,
FiledName = t.ItemName,
SourceType = t.SourceType ?? 0,
Type = t.Type ?? 0,
......@@ -346,9 +349,13 @@ private List<BodyItem> GetBodyItems(List<ag_fixatitem> fixatitems, List<HeadItem
Sort = t.Sort ?? 0
}).ToList();
}
// 删除多余的headvalue
bodyItems.RemoveAll(t => !headItems.Select(h => h.FiledId).Contains(t.FiledId) && t.RowNumber == -1);
return bodyItems;
}
/// <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