feat 二级路由更改及设备人员数据
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -30,4 +31,10 @@ public interface IGainfoService : IScopeDependency
|
||||
Task<Pagination<GainfoListResponse>> GetGainfoListTaskAsync(GainfoListRequest request);
|
||||
|
||||
Task<GainfoDetailResponse> GetGainfoDetailTaskAsync(GainfoDetailRequest request);
|
||||
|
||||
Task<Dictionary<string, Pagination<GainfoDetailResponse>>> GetWeekNumberAsync(WeekNumberRequest request);
|
||||
|
||||
Task<Dictionary<string, Pagination<GainfoDetailResponse>>> GetDimissionWeekNumberAsync([FromQuery] WeekNumberRequest request);
|
||||
|
||||
Task<GainfoGainfoNumbersResponse> GetGainfoNumbersAsync(string Werks);
|
||||
}
|
||||
|
||||
@@ -377,6 +377,136 @@ public class GainfoService : IGainfoService
|
||||
return info;
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, Pagination<GainfoDetailResponse>>> GetWeekNumberAsync(WeekNumberRequest request)
|
||||
{
|
||||
//获取近7天并转化为"yyyy-MM-dd"集合
|
||||
DateTime currentDate = DateTime.Now;
|
||||
List<string> times = new List<string>();
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
DateTime date = currentDate.AddDays(-i);
|
||||
string dateString = date.ToString("yyyy-MM-dd");
|
||||
times.Add(dateString);
|
||||
}
|
||||
|
||||
var dic = new Dictionary<string, Pagination<GainfoDetailResponse>>();
|
||||
|
||||
foreach (var time in times)
|
||||
{
|
||||
var infos = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
||||
.LeftJoin<DepartmentEntity>((ga, de) => ga.DepartmentNo == de.No)
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type) => ga.Native == type.Code && type.Type == "native")
|
||||
.LeftJoin<PositionEntity>((ga, de, type, posi) => ga.Position == posi.Name)
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type, posi, type2) => ga.CountryNo == type2.Code && type2.Type == "country")
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type, posi, type2, type3) => ga.Nation == type3.Code && type3.Type == "nation")
|
||||
.Where(ga => ga.CreateTime.ToString("yyyy-MM-dd") == time)
|
||||
.Select((ga, de, type, posi, type2, type3) => new GainfoDetailResponse
|
||||
{
|
||||
No = ga.No,
|
||||
SapNo = ga.SapNo,
|
||||
Name = ga.Name,
|
||||
Code = ga.Code,
|
||||
DepartmentName = de.Name,
|
||||
IdClass = ga.IdClass,
|
||||
IdNo = ga.IdNo,
|
||||
Gender = ga.Gender,
|
||||
NativeName = type.Display,
|
||||
Address = ga.Address,
|
||||
Birthday = ga.Birthday,
|
||||
Phone = ga.Phone,
|
||||
Position = ga.Position,
|
||||
Grade = posi.Grade,
|
||||
Degree = ga.Degree,
|
||||
Werks = ga.Werks,
|
||||
CostId = ga.CostId,
|
||||
Marital = ga.Marital,
|
||||
CountryName = type2.Display,
|
||||
NationName = type3.Display,
|
||||
IsActive = ga.Employed == "Active" ? true : false,
|
||||
}).ToPageListAsync(request);
|
||||
//var infos = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
||||
// .Where(ga => ga.CreateTime.ToString("yyyy-MM-dd") == time)
|
||||
// .ToPageListAsync(request);
|
||||
dic[time] = infos;
|
||||
}
|
||||
return dic;
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, Pagination<GainfoDetailResponse>>> GetDimissionWeekNumberAsync([FromQuery] WeekNumberRequest request)
|
||||
{
|
||||
//获取近7天并转化为"yyyy-MM-dd"集合
|
||||
DateTime currentDate = DateTime.Now;
|
||||
List<string> times = new List<string>();
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
DateTime date = currentDate.AddDays(-i);
|
||||
string dateString = date.ToString("yyyy-MM-dd");
|
||||
times.Add(dateString);
|
||||
}
|
||||
|
||||
var dic = new Dictionary<string, Pagination<GainfoDetailResponse>>();
|
||||
foreach (var time in times)
|
||||
{
|
||||
var infos = await _gainfoStore.Queryable(GainfoStatusEnumType.Leave)
|
||||
.LeftJoin<DepartmentEntity>((ga, de) => ga.DepartmentNo == de.No)
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type) => ga.Native == type.Code && type.Type == "native")
|
||||
.LeftJoin<PositionEntity>((ga, de, type, posi) => ga.Position == posi.Name)
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type, posi, type2) => ga.CountryNo == type2.Code && type2.Type == "country")
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type, posi, type2, type3) => ga.Nation == type3.Code && type3.Type == "nation")
|
||||
.Where(ga => ga.CreateTime.ToString("yyyy-MM-dd") == time)
|
||||
.Select((ga, de, type, posi, type2, type3) => new GainfoDetailResponse
|
||||
{
|
||||
No = ga.No,
|
||||
SapNo = ga.SapNo,
|
||||
Name = ga.Name,
|
||||
Code = ga.Code,
|
||||
DepartmentName = de.Name,
|
||||
IdClass = ga.IdClass,
|
||||
IdNo = ga.IdNo,
|
||||
Gender = ga.Gender,
|
||||
NativeName = type.Display,
|
||||
Address = ga.Address,
|
||||
Birthday = ga.Birthday,
|
||||
Phone = ga.Phone,
|
||||
Position = ga.Position,
|
||||
Grade = posi.Grade,
|
||||
Degree = ga.Degree,
|
||||
Werks = ga.Werks,
|
||||
CostId = ga.CostId,
|
||||
Marital = ga.Marital,
|
||||
CountryName = type2.Display,
|
||||
NationName = type3.Display,
|
||||
IsActive = ga.Employed == "Active" ? true : false,
|
||||
}).ToPageListAsync(request);
|
||||
dic[time] = infos;
|
||||
}
|
||||
return dic;
|
||||
}
|
||||
|
||||
public async Task<GainfoGainfoNumbersResponse> GetGainfoNumbersAsync(string Werks)
|
||||
{
|
||||
//在职人数
|
||||
var onlineNumber = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
||||
.Where(ga => ga.Werks == Werks)
|
||||
.CountAsync();
|
||||
|
||||
//离职人数
|
||||
var offlineNumber = await _gainfoStore.Queryable(GainfoStatusEnumType.Leave)
|
||||
.Where(ga => ga.Werks == Werks)
|
||||
.CountAsync();
|
||||
|
||||
//考勤总人数
|
||||
var attendanceNumber = onlineNumber + offlineNumber;
|
||||
|
||||
var res = new GainfoGainfoNumbersResponse
|
||||
{
|
||||
OnlineNumber = onlineNumber,
|
||||
OfflineNumber = offlineNumber,
|
||||
AttendanceNumber = attendanceNumber
|
||||
};
|
||||
return res;
|
||||
}
|
||||
|
||||
//-------------------------------------------help methods ------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user