feat 门岗申请记录列表
This commit is contained in:
@@ -2,6 +2,7 @@ using Dlhis.Basic.Appointment.Request;
|
||||
using Dlhis.Basic.Appointment.Response;
|
||||
using Dlhis.Basic.Appointment.Services;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Visitor.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
@@ -82,6 +83,21 @@ public class AppointmentsController : ControllerBase
|
||||
return await _appointmentService.GetTodayByIdNoAsync(idNo, factory);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 门禁预约
|
||||
/// </summary>
|
||||
/// <param name="factory"></param>
|
||||
/// <param name="status"></param>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("door/list")]
|
||||
public async Task<List<AppointmentDetailResponse>> GetRecordListAsync(string factory, VisitorAppointmentDetailStatusEnumType status, DateTime start, DateTime end)
|
||||
{
|
||||
return await _appointmentService.GetRecordListAsync(factory, status, start, end);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据身份证获取预约信息分页
|
||||
/// </summary>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Dlhis.Basic.Appointment.Request;
|
||||
using Dlhis.Basic.Appointment.Response;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Visitor.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -37,6 +38,15 @@ public interface IAppointmentService : IScopeDependency
|
||||
/// <returns></returns>
|
||||
Task<AppointmentDetailResponse> GetTodayByIdNoAsync(string idNo, string factory);
|
||||
|
||||
/// <summary>
|
||||
/// 获取记录列表
|
||||
/// </summary>
|
||||
/// <param name="factory"></param>
|
||||
/// <param name="status"></param>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<AppointmentDetailResponse>> GetRecordListAsync(string factory, VisitorAppointmentDetailStatusEnumType status, DateTime start, DateTime end);
|
||||
|
||||
Task<Pagination<AppointmentDetailResponse>> GetRecordPageByIdNoAsync([FromQuery] AppointmentIdNoPageRequest request);
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ public class AppointmentService : IAppointmentService
|
||||
|
||||
var now = DateTime.Now;
|
||||
return await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
.LeftJoin<GainfoEntity>((x, ga) => ga.IdNo == idNo)
|
||||
.LeftJoin<GainfoEntity>((x, ga) => ga.IdNo == x.IdNo)
|
||||
.Where((x, ga) => ga.IdNo == idNo)
|
||||
.Where(x => (x.IsEnterDoorArea && SqlFunc.DateIsSame(x.DoorStart, now) && x.DoorStatus == VisitorAppointmentDetailStatusEnumType.Wait))
|
||||
.Where(x => SqlFunc.Subqueryable<VisitorAppointmentEntity>().Where(p => p.Factory == factory).Where(p => p.No == x.No).Any())
|
||||
@@ -205,29 +205,64 @@ public class AppointmentService : IAppointmentService
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<AppointmentDetailResponse>> GetRecordListAsync(string factory, VisitorAppointmentDetailStatusEnumType status, DateTime start, DateTime end)
|
||||
{
|
||||
return await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
.LeftJoin<GainfoEntity>((x, ga) => ga.IdNo == x.IdNo)
|
||||
.Where(x => SqlFunc.Subqueryable<VisitorAppointmentEntity>().Where(p => p.Factory == factory).Any())
|
||||
.Where(x => x.IsEnterDoorArea && x.DoorStatus == status)
|
||||
.Where(x => x.DoorStart >= start && x.DoorEnd <= end)
|
||||
.Select(x => new AppointmentDetailResponse
|
||||
{
|
||||
No = x.No,
|
||||
Mst = SqlFunc.Subqueryable<VisitorAppointmentEntity>()
|
||||
.LeftJoin<GainfoEntity>((p, ga) => p.Code == ga.Code)
|
||||
.Where((p, ga) => p.No == x.No)
|
||||
.First((p, ga) => new AppointmentPageResponse
|
||||
{
|
||||
No = p.No,
|
||||
Title = p.Title,
|
||||
Code = p.Code,
|
||||
Name = ga.Name,
|
||||
Source = p.Source,
|
||||
Date = p.Date,
|
||||
Remark = p.Remark,
|
||||
Factory = p.Factory,
|
||||
Reason = p.Reason
|
||||
}, false)
|
||||
}, true)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<AppointmentSummaryResponse> GetSummaryAsync(string factory, DateTime start, DateTime end)
|
||||
{
|
||||
var total = await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
.Where(x => (x.IsEnterDoorArea && ((x.DoorStart >= start && x.DoorStart <= end) || x.DoorEnd >= start && x.DoorEnd <= end)) ||
|
||||
(x.IsEnterWorkplace && ((x.WorkplaceStart >= start && x.WorkplaceStart <= end) || (x.WorkplaceEnd >= start && x.WorkplaceEnd <= end)))
|
||||
.Where(x => x.IsEnterDoorArea && ((x.DoorStart >= start && x.DoorStart <= end) || (x.DoorEnd >= start && x.DoorEnd <= end))
|
||||
//|| (x.IsEnterWorkplace && ((x.WorkplaceStart >= start && x.WorkplaceStart <= end) || (x.WorkplaceEnd >= start && x.WorkplaceEnd <= end)))
|
||||
)
|
||||
.Where(x => SqlFunc.Subqueryable<VisitorAppointmentEntity>().Where(p => p.Factory == factory).Any())
|
||||
.CountAsync();
|
||||
|
||||
var @in = await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
.Where(x => (x.IsEnterDoorArea && ((x.DoorStart >= start && x.DoorStart <= end) || x.DoorEnd >= start && x.DoorEnd <= end)) ||
|
||||
(x.IsEnterWorkplace && ((x.WorkplaceStart >= start && x.WorkplaceStart <= end) || (x.WorkplaceEnd >= start && x.WorkplaceEnd <= end)))
|
||||
.Where(x => x.IsEnterDoorArea && ((x.DoorStart >= start && x.DoorStart <= end) || (x.DoorEnd >= start && x.DoorEnd <= end))
|
||||
// || (x.IsEnterWorkplace && ((x.WorkplaceStart >= start && x.WorkplaceStart <= end) || (x.WorkplaceEnd >= start && x.WorkplaceEnd <= end)))
|
||||
)
|
||||
.Where(x => (x.IsEnterDoorArea && x.DoorStatus == VisitorAppointmentDetailStatusEnumType.Arrived)
|
||||
//|| (x.IsEnterWorkplace && x.WorkplaceStatus == VisitorAppointmentDetailStatusEnumType.Arrived)
|
||||
)
|
||||
.Where(x => (x.IsEnterDoorArea && x.DoorStatus == VisitorAppointmentDetailStatusEnumType.Arrived) || (x.IsEnterWorkplace && x.WorkplaceStatus == VisitorAppointmentDetailStatusEnumType.Arrived))
|
||||
.Where(x => SqlFunc.Subqueryable<VisitorAppointmentEntity>().Where(p => p.Factory == factory).Any())
|
||||
.CountAsync();
|
||||
|
||||
var notIn = await _dbContext.Queryable<VisitorAppointmentDetailEntity>()
|
||||
.Where(x => (x.IsEnterDoorArea && ((x.DoorStart >= start && x.DoorStart <= end) || x.DoorEnd >= start && x.DoorEnd <= end)) ||
|
||||
(x.IsEnterWorkplace && ((x.WorkplaceStart >= start && x.WorkplaceStart <= end) || (x.WorkplaceEnd >= start && x.WorkplaceEnd <= end)))
|
||||
.Where(x => x.IsEnterDoorArea && ((x.DoorStart >= start && x.DoorStart <= end) || (x.DoorEnd >= start && x.DoorEnd <= end))
|
||||
//|| (x.IsEnterWorkplace && ((x.WorkplaceStart >= start && x.WorkplaceStart <= end) || (x.WorkplaceEnd >= start && x.WorkplaceEnd <= end)))
|
||||
)
|
||||
.Where(x => (x.IsEnterDoorArea && x.DoorStatus == VisitorAppointmentDetailStatusEnumType.Wait)
|
||||
//|| (x.IsEnterWorkplace && x.WorkplaceStatus == VisitorAppointmentDetailStatusEnumType.Wait)
|
||||
)
|
||||
.Where(x => (x.IsEnterDoorArea && x.DoorStatus == VisitorAppointmentDetailStatusEnumType.Wait) || (x.IsEnterWorkplace && x.WorkplaceStatus == VisitorAppointmentDetailStatusEnumType.Wait))
|
||||
.Where(x => SqlFunc.Subqueryable<VisitorAppointmentEntity>().Where(p => p.Factory == factory).Any())
|
||||
.CountAsync();
|
||||
|
||||
@@ -235,7 +270,9 @@ public class AppointmentService : IAppointmentService
|
||||
.Where(x => (x.IsEnterDoorArea && x.DoorEnd >= start && x.DoorEnd <= end) ||
|
||||
(x.IsEnterWorkplace && x.WorkplaceEnd >= start && x.WorkplaceEnd <= end)
|
||||
)
|
||||
.Where(x => (x.IsEnterDoorArea && x.DoorStatus == VisitorAppointmentDetailStatusEnumType.Leave) || (x.IsEnterWorkplace && x.WorkplaceStatus == VisitorAppointmentDetailStatusEnumType.Leave))
|
||||
.Where(x => (x.IsEnterDoorArea && x.DoorStatus == VisitorAppointmentDetailStatusEnumType.Leave)
|
||||
//|| (x.IsEnterWorkplace && x.WorkplaceStatus == VisitorAppointmentDetailStatusEnumType.Leave)
|
||||
)
|
||||
.Where(x => SqlFunc.Subqueryable<VisitorAppointmentEntity>().Where(p => p.Factory == factory).Any())
|
||||
.CountAsync();
|
||||
|
||||
@@ -243,7 +280,9 @@ public class AppointmentService : IAppointmentService
|
||||
.Where(x => (x.IsEnterDoorArea && x.DoorEnd >= start && x.DoorEnd <= end) ||
|
||||
(x.IsEnterWorkplace && x.WorkplaceEnd >= start && x.WorkplaceEnd <= end)
|
||||
)
|
||||
.Where(x => (x.IsEnterDoorArea && x.DoorStatus != VisitorAppointmentDetailStatusEnumType.Leave) || (x.IsEnterWorkplace && x.WorkplaceStatus != VisitorAppointmentDetailStatusEnumType.Leave))
|
||||
.Where(x => (x.IsEnterDoorArea && x.DoorStatus != VisitorAppointmentDetailStatusEnumType.Leave)
|
||||
// || (x.IsEnterWorkplace && x.WorkplaceStatus != VisitorAppointmentDetailStatusEnumType.Leave)
|
||||
)
|
||||
.Where(x => SqlFunc.Subqueryable<VisitorAppointmentEntity>().Where(p => p.Factory == factory).Any())
|
||||
.CountAsync();
|
||||
|
||||
|
||||
@@ -28,22 +28,17 @@ public class GainfoMealService : IGainfoMealService
|
||||
public async Task<Pagination<GainfoMealResponse>> GetPageAsync(GainfoMealPageRequest request)
|
||||
{
|
||||
var factory = _currentUser.GetStringTenantId();
|
||||
var factories = await GetWalletFactoriesAsync(factory);
|
||||
|
||||
return await _dbContext.Queryable<GainfoEntity>().AS(request.IsLeave ? "GainfoLeave" : "Gainfo")
|
||||
var page = await _dbContext.Queryable<GainfoEntity>().AS(request.IsLeave ? "GainfoLeave" : "Gainfo")
|
||||
.LeftJoin<DepartmentEntity>((x, dept) => dept.No == x.DepartmentNo)
|
||||
.LeftJoin<MealSupplementRecordEntity>((x, dept, ms) => ms.Code == x.Code)
|
||||
.LeftJoin<BalanceRecordEntity>((x, dept, ms, b) => b.UserCode == x.Code)
|
||||
.Where(x => x.Factory == factory)
|
||||
.WhereIF(request.Search.IsPresent(), x => x.Code == request.Search || x.Name == request.Search)
|
||||
.WhereIF(request.IsLeave && request.SearchDateTimePeriod.HasValue(), x => x.ResignationDate >= request.SearchDateTimePeriod.Start &&
|
||||
x.ResignationDate <= request.SearchDateTimePeriod.End)
|
||||
.Where((x, dept, ms) => factories.Contains(ms.Factory))
|
||||
.WhereIF(request.SearchDateTimePeriod.HasValue(), (x, dept, ms) => ms.Date >= request.SearchDateTimePeriod.Start && ms.Date <= request.SearchDateTimePeriod.End)
|
||||
.Where((x, dept, ms, b) => factories.Contains(b.TenantId))
|
||||
.Where((x, dept, ms, b) => b.Status == BalanceRecordStatusEnumType.Valid)
|
||||
.Where((x, dept, ms, b) => b.Source != BalanceRecordSourceEnumType.EMealVoucher)
|
||||
.GroupBy((x, dept, ms, b) => new { UserCode = x.Code, UserName = x.Name, UserNo = x.No, DepartmentName = dept.Name })
|
||||
.Select((x, dept, ms, b) => new GainfoMealResponse
|
||||
.GroupBy((x, dept, ms) => new { UserCode = x.Code, UserName = x.Name, UserNo = x.No, DepartmentName = dept.Name })
|
||||
.Select((x, dept, ms) => new GainfoMealResponse
|
||||
{
|
||||
UserCode = x.Code,
|
||||
UserName = x.Name,
|
||||
@@ -51,9 +46,28 @@ public class GainfoMealService : IGainfoMealService
|
||||
DepartmentName = dept.Name,
|
||||
Status = request.IsLeave ? GainfoStatusEnumType.Leave : GainfoStatusEnumType.Working,
|
||||
CurrentMealSupplementAmount = SqlFunc.AggregateSum(ms.Amount),
|
||||
CurrentBalance = SqlFunc.AggregateSum(b.Amount)
|
||||
//CurrentBalance = SqlFunc.AggregateSum(b.Amount)
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
|
||||
var userCodes = page.Data.Select(x => x.UserCode).ToList();
|
||||
|
||||
var data = await _dbContext.Queryable<BalanceRecordEntity>().Where(x => x.Status == BalanceRecordStatusEnumType.Valid && x.Source != BalanceRecordSourceEnumType.EMealVoucher)
|
||||
.Where(x => userCodes.Contains(x.UserCode))
|
||||
.GroupBy(x => x.UserCode)
|
||||
.Select(x => new { x.UserCode, Balance = SqlFunc.AggregateSum(x.Amount) }).ToListAsync();
|
||||
|
||||
|
||||
foreach (var item in page.Data)
|
||||
{
|
||||
var d1 = data.FirstOrDefault(x => x.UserCode == item.UserCode);
|
||||
if (d1 != null)
|
||||
{
|
||||
item.CurrentBalance = d1.Balance;
|
||||
}
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -134,6 +134,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService
|
||||
.Select(x => SqlFunc.AggregateMax(x.RaiseDateTime))
|
||||
.SingleAsync();
|
||||
|
||||
//0001-01-01 00:00:00
|
||||
return new DateTimePeriod
|
||||
{
|
||||
Start = start,
|
||||
|
||||
@@ -338,10 +338,14 @@ public class AssignmentService : IAssignmentService
|
||||
var deviceNos = data.Select(x => x.DeviceUniqueNo).Distinct().ToList();
|
||||
var result = new Dictionary<string, DateTime?>(deviceNos.Count);
|
||||
|
||||
var logInfos = await _dbContext.Queryable<DeviceUploadLogEntity>().GroupBy(x => x.DeviceUniqueNo).Select(x => new
|
||||
var logInfos = await _dbContext.Queryable<DeviceUploadLogEntity>()
|
||||
.GroupBy(x => x.DeviceUniqueNo)
|
||||
.Select(x => new
|
||||
{
|
||||
x.DeviceUniqueNo, RaiseDateTime = SqlFunc.AggregateMax(x.RaiseDateTime)
|
||||
}).ToListAsync();
|
||||
x.DeviceUniqueNo,
|
||||
RaiseDateTime = SqlFunc.AggregateMax(x.RaiseDateTime)
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var item in deviceNos)
|
||||
{
|
||||
@@ -353,8 +357,6 @@ public class AssignmentService : IAssignmentService
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 处理老档案数据
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user