fix 档案详情优化

This commit is contained in:
cheche
2024-03-11 14:33:48 +08:00
parent 400ea0152c
commit 12b577e0d7
3 changed files with 44 additions and 5 deletions

View File

@@ -1,5 +1,7 @@
using Dlhis.Entity.Basic.Enums;
using Kurisu.AspNetCore.Utils.Extensions;
using SqlSugar;
using System.ComponentModel.DataAnnotations;
namespace Dlhis.Basic.Organization.Response;
@@ -25,6 +27,11 @@ public class GainfoDetailResponse
/// </summary>
public string Code { get; set; }
/// <summary>
/// 部门
/// </summary>
public string DepartmentNo { get; set; }
/// <summary>
/// 部门名称
/// </summary>
@@ -121,5 +128,23 @@ public class GainfoDetailResponse
/// </summary>
public string Face { get; set; }
/// <summary>
/// 在职状态
/// </summary>
public string Status { get; set; }
/// <summary>
/// 厂区
/// </summary>
public string Factory { get; set; }
/// <summary>
/// 厂区名称
/// </summary>
public string FactoryName { get; set; }
/// <summary>
/// 入职日期
/// </summary>
public DateTime OnboardingDate { get; set; }
}

View File

@@ -28,6 +28,7 @@ public class GainfoService : IGainfoService
private readonly IServiceProvider _serviceProvider;
private readonly IConfiguration _configuration;
private readonly ILogger<GainfoService> _logger;
private readonly IDepartmentService _departmentService;
public GainfoService(IGainfoStore gainfoStore,
IDbContext dbContext,
@@ -36,7 +37,8 @@ public class GainfoService : IGainfoService
RedisCache redisCache,
IServiceProvider serviceProvider,
IConfiguration configuration,
ILogger<GainfoService> logger)
ILogger<GainfoService> logger,
IDepartmentService departmentService = null)
{
_gainfoStore = gainfoStore;
_dbContext = dbContext;
@@ -46,6 +48,7 @@ public class GainfoService : IGainfoService
_serviceProvider = serviceProvider;
_configuration = configuration;
_logger = logger;
_departmentService = departmentService;
}
/// <summary>
@@ -420,8 +423,17 @@ public class GainfoService : IGainfoService
CountryName = type2.Display,
NationName = type3.Display,
ClassName = type4.Display,
Factory = ga.Factory,
OnboardingDate = ga.CreateTime,
})
.FirstAsync();
info.Status = request.Status.GetDescription();
var trees = await _departmentService.GetTreeAsync();
var res = trees.First(x => x.No == info.Factory);
if (res != null)
{
info.FactoryName = res.Name;
}
if (info != null)
{

View File

@@ -158,7 +158,7 @@ public class BalanceService : IBalanceService
obj.LateNightPrice = LateNightNumberOfPeople == 0 ? 0 : Math.Round(obj.LateNightAmount / LateNightNumberOfPeople, 2);
// 总人数 总金额
obj.TotalNumberOfPeople = obj.BreakfastNumberOfPeople + obj.LunchNumberOfPeople + obj.DinnerNumberOfPeople + obj.LateNightNumberOfPeople;
obj.TotalNumberOfPeople = costIdGroup.Select(x => x.UserNo).Distinct().Count();
obj.TotalAmount = obj.BreakfastAmount + obj.LunchAmount + obj.DinnerAmount + obj.LateNightAmount;
lst.Add(obj);
@@ -292,7 +292,7 @@ public class BalanceService : IBalanceService
obj.LateNightPrice = LateNightNumberOfPeople == 0 ? 0 : Math.Round(obj.LateNightAmount / LateNightNumberOfPeople, 2);
// 总人数 总金额
obj.TotalNumberOfPeople = obj.BreakfastNumberOfPeople + obj.LunchNumberOfPeople + obj.DinnerNumberOfPeople + obj.LateNightNumberOfPeople;
obj.TotalNumberOfPeople = departmentGroup.Select(x => x.UserNo).Distinct().Count();
obj.TotalAmount = obj.BreakfastAmount + obj.LunchAmount + obj.DinnerAmount + obj.LateNightAmount;
lst.Add(obj);
}
@@ -372,7 +372,7 @@ public class BalanceService : IBalanceService
obj.LateNightPrice = LateNightNumberOfPeople == 0 ? 0 : Math.Round(obj.LateNightAmount / LateNightNumberOfPeople, 2);
// 总人数 总金额
obj.TotalNumberOfPeople = obj.BreakfastNumberOfPeople + obj.LunchNumberOfPeople + obj.DinnerNumberOfPeople + obj.LateNightNumberOfPeople;
obj.TotalNumberOfPeople = originTenantIdGroup.Select(x => x.UserNo).Distinct().Count();
obj.TotalAmount = obj.BreakfastAmount + obj.LunchAmount + obj.DinnerAmount + obj.LateNightAmount;
lst.Add(obj);
}
@@ -421,7 +421,9 @@ public class BalanceService : IBalanceService
obj.LunchNumberOfPeople = first.Where(x => x.ShiftType == shiftCodeDict["Lunch"]).Select(x => x.UserNo).Distinct().Count();
obj.DinnerNumberOfPeople = first.Where(x => x.ShiftType == shiftCodeDict["Dinner"]).Select(x => x.UserNo).Distinct().Count();
obj.LateNightNumberOfPeople = first.Where(x => x.ShiftType == shiftCodeDict["LateNight"]).Select(x => x.UserNo).Distinct().Count();
obj.TotalNumberOfPeople = obj.BreakfastNumberOfPeople + obj.LunchNumberOfPeople + obj.DinnerNumberOfPeople + obj.LateNightNumberOfPeople;
obj.TotalNumberOfPeople = first.Where(x => x.CostDate.ToString("yyyy-MM-dd") == first.Key).Select(x => x.UserNo).Distinct().Count();
lst.Add(obj);
}
// 分页操作