Commit 5e1d10de by wyc

科室详情设置加载

parent c94a4c73
...@@ -211,6 +211,9 @@ public ApiResponse UniteDeptDetail([FromBody] UniteDeptDetailRequest request) ...@@ -211,6 +211,9 @@ public ApiResponse UniteDeptDetail([FromBody] UniteDeptDetailRequest request)
return new ApiResponse(ResponseType.OK, response); return new ApiResponse(ResponseType.OK, response);
} }
#region 20230531 即将弃用,由新接口替代 #region 20230531 即将弃用,由新接口替代
/// <summary> /// <summary>
/// 科室绩效详情 /// 科室绩效详情
......
...@@ -4,6 +4,7 @@ namespace Performance.DtoModels ...@@ -4,6 +4,7 @@ namespace Performance.DtoModels
{ {
public class UniteDeptDetailResponse public class UniteDeptDetailResponse
{ {
public string Title { get; set; }
public string UnitType { get; set; } public string UnitType { get; set; }
public string AccountingUnit { get; set; } public string AccountingUnit { get; set; }
/// <summary> 0 不显示 1 显示 </summary> /// <summary> 0 不显示 1 显示 </summary>
......
...@@ -5,13 +5,12 @@ namespace Performance.DtoModels ...@@ -5,13 +5,12 @@ namespace Performance.DtoModels
{ {
public class UniteDeptDetailItem public class UniteDeptDetailItem
{ {
public int Type { get; set; }
public int SheetType { get; set; } public int SheetType { get; set; }
public string Title { get; set; } public string Title { get; set; }
public string Remark { get; set; } public string Remark { get; set; }
public string Format { get; set; } public string Format { get; set; }
public int Sort { get; set; } public int Sort { get; set; }
public string Display { get; set; } public string Display { get; set; }
public List<UniteDeptDetailItem> Items { get; set; } public List<UniteDeptDetailItem> Children { get; set; }
} }
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace Performance.Repository namespace Performance.Repository
{ {
/// <summary> /// <summary>
/// cof_cmi Repository /// cof_dept_detail
/// </summary> /// </summary>
public partial class PerforCofDeptDetailRepository : PerforRepository<cof_dept_detail> public partial class PerforCofDeptDetailRepository : PerforRepository<cof_dept_detail>
{ {
......
...@@ -50,7 +50,13 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s ...@@ -50,7 +50,13 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
var headers = _perforImheaderRepository.GetEntities(t => t.AllotID == account.AllotID) ?? new List<im_header>(); var headers = _perforImheaderRepository.GetEntities(t => t.AllotID == account.AllotID) ?? new List<im_header>();
var basicData = _perforImDataRepository.GetEntities(t => t.AllotID == account.AllotID && t.AccountingUnit == account.AccountingUnit) ?? new List<im_data>(); var basicData = _perforImDataRepository.GetEntities(t => t.AllotID == account.AllotID && t.AccountingUnit == account.AccountingUnit) ?? new List<im_data>();
var response = new UniteDeptDetailResponse { UnitType = unitType.ToString(), AccountingUnit = accountingUnit, DetailItems = new List<DeptDetailItem>() }; var response = new UniteDeptDetailResponse
{
Title = $"{allot.Name ?? $"{allot.Year}{allot.Month}月"} {unitType} {accountingUnit}",
UnitType = unitType.ToString(),
AccountingUnit = accountingUnit,
DetailItems = new List<DeptDetailItem>()
};
// 行政工勤 // 行政工勤
if (UnitTypeUtil.IsOffice(response.UnitType)) if (UnitTypeUtil.IsOffice(response.UnitType))
{ {
...@@ -244,6 +250,16 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s ...@@ -244,6 +250,16 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
row.Add("金额", ValueFormating(itemValue, "")); row.Add("金额", ValueFormating(itemValue, ""));
items.Add(row); items.Add(row);
} }
// 保证Key数量一致
var keys = items.SelectMany(dict => dict.Keys).Distinct();
foreach (var k in keys)
{
foreach (var item in items)
{
if (!item.ContainsKey(k))
item.Add(k, "");
}
}
items.Add(new Dictionary<string, object> items.Add(new Dictionary<string, object>
{ {
{ "项目", "核算分值合计"}, { "项目", "核算分值合计"},
...@@ -431,11 +447,6 @@ private string BeautifulName(string sheetName) ...@@ -431,11 +447,6 @@ private string BeautifulName(string sheetName)
/// <exception cref="PerformanceException"></exception> /// <exception cref="PerformanceException"></exception>
public List<UniteDeptDetailItem> GetUniteDeptDetailSetting(int allotId) public List<UniteDeptDetailItem> GetUniteDeptDetailSetting(int allotId)
{ {
var entity = _perforCofDeptDetailRepository.GetEntity(w => w.AllotId == allotId);
if (!string.IsNullOrEmpty(entity?.Settings))
{
return JsonHelper.Deserialize<List<UniteDeptDetailItem>>(entity.Settings);
}
var allot = perforPerallotRepository.GetEntity(t => t.ID == allotId); var allot = perforPerallotRepository.GetEntity(t => t.ID == allotId);
if (allot == null) throw new PerformanceException("绩效月信息错误"); if (allot == null) throw new PerformanceException("绩效月信息错误");
...@@ -484,11 +495,17 @@ public List<UniteDeptDetailItem> GetUniteDeptDetailSetting(int allotId) ...@@ -484,11 +495,17 @@ public List<UniteDeptDetailItem> GetUniteDeptDetailSetting(int allotId)
if (ignore.Contains(post.Key.TypeName)) continue; if (ignore.Contains(post.Key.TypeName)) continue;
items.Add(new UniteDeptDetailItem { Title = post.Key.TypeName }); items.Add(new UniteDeptDetailItem { Title = post.Key.TypeName });
} }
detail.Items = items; detail.Children = items;
} }
} }
} }
#endregion #endregion
var entity = _perforCofDeptDetailRepository.GetEntity(w => w.AllotId == allotId);
var cofDeptDetail = string.IsNullOrEmpty(entity?.Settings)
? new List<UniteDeptDetailItem>()
: JsonHelper.Deserialize<List<UniteDeptDetailItem>>(entity.Settings);
var enumItems = EnumHelper.GetItems<UniteDept.Title>(); var enumItems = EnumHelper.GetItems<UniteDept.Title>();
foreach (var detail in response) foreach (var detail in response)
{ {
...@@ -496,9 +513,30 @@ public List<UniteDeptDetailItem> GetUniteDeptDetailSetting(int allotId) ...@@ -496,9 +513,30 @@ public List<UniteDeptDetailItem> GetUniteDeptDetailSetting(int allotId)
var cfg = enumItems.FirstOrDefault(w => w.Name == detail.Title); var cfg = enumItems.FirstOrDefault(w => w.Name == detail.Title);
// 只对右侧设置排序 // 只对右侧设置排序
detail.Sort = cfg == null ? detail.Sort : cfg.Value; detail.Sort = cfg == null ? detail.Sort : cfg.Value;
// 读取数据库保存内容
detail.Children ??= new List<UniteDeptDetailItem>();
var temp1 = cofDeptDetail.FirstOrDefault(w => w.Title == detail.Title);
if (temp1 == null) continue;
detail.SheetType = temp1.SheetType;
detail.Remark = temp1.Remark;
detail.Title = temp1.Title;
detail.Format = temp1.Format;
detail.Sort = temp1.Sort;
detail.Display = temp1.Display;
foreach (var item in detail.Children)
{
var temp2 = cofDeptDetail.FirstOrDefault(w => w.Title == item.Title);
if (temp2 == null) continue;
detail.SheetType = temp2.SheetType;
detail.Remark = temp2.Remark;
detail.Title = temp2.Title;
detail.Format = temp2.Format;
detail.Sort = temp2.Sort;
detail.Display = temp2.Display;
}
} }
response = response.OrderBy(w => w.Type).ThenBy(w => w.Sort).ToList(); response = response.OrderBy(w => w.Sort).ToList();
return response; return response;
} }
......
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