fix 餐补查询及日志删除
This commit is contained in:
@@ -181,6 +181,16 @@ public class BalancesController : ControllerBase
|
||||
return await _balanceService.GetConsumeDeviceAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询餐补
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("balanceRecordByUser")]
|
||||
public async Task<Pagination<BalanceRecordByUserResponse>> BalanceRecordByUserAsync([FromQuery]BalanceRecordByUserRequest request)
|
||||
{
|
||||
return await _balanceService.BalanceRecordByUserAsync(request);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Request
|
||||
{
|
||||
public class BalanceRecordByUserRequest : PageDto
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,6 @@ namespace Dlhis.Canteen.Dishes.Request
|
||||
/// <summary>
|
||||
/// 餐券id
|
||||
/// </summary>
|
||||
public long OaEMealVoucherId { get; set; }
|
||||
public long? OaEMealVoucherId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,5 @@ namespace Dlhis.Canteen.Dishes.Request
|
||||
{
|
||||
public class OaEMealVoucherRequest : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户学工号
|
||||
/// </summary>
|
||||
public string UserCode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
149
Src/Dlhis.Canteen/Order/Response/BalanceRecordByUserResponse.cs
Normal file
149
Src/Dlhis.Canteen/Order/Response/BalanceRecordByUserResponse.cs
Normal file
@@ -0,0 +1,149 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using SqlSugar.DbConvert;
|
||||
using SqlSugar;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Response
|
||||
{
|
||||
public class BalanceRecordByUserResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 流水号
|
||||
/// </summary>
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 档案号/QRCode
|
||||
/// </summary>
|
||||
public string UserNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 学工号
|
||||
/// </summary>
|
||||
public string UserCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门号
|
||||
/// </summary>
|
||||
public string DepartmentNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源
|
||||
/// </summary>
|
||||
public BalanceRecordSourceEnumType Source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源CN
|
||||
/// </summary>
|
||||
public string SourceCN => Source.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 收入/支出
|
||||
/// </summary>
|
||||
public BalanceRecordTypeEnumType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 收入/支出
|
||||
/// </summary>
|
||||
public string TypeCN => Type.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 金额 + - 表示
|
||||
/// </summary>
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
public Guid? BusinessPlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐别
|
||||
/// </summary>
|
||||
public Guid? BusinessShiftCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
public ShiftEnumType? ShiftType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次CN
|
||||
/// </summary>
|
||||
public string ShiftTypeCN => ShiftType.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 所属成本日期
|
||||
/// </summary>
|
||||
public DateTime CostDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消费机器唯一信息
|
||||
/// </summary>
|
||||
public string DeviceUniqueNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐补月份
|
||||
/// </summary>
|
||||
public string SubsidiesFromMonth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ip
|
||||
/// </summary>
|
||||
public string IP { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 成本中心
|
||||
/// </summary>
|
||||
public string CostId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消费者所在基地
|
||||
/// </summary>
|
||||
public string OriginTenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 成本计算是否允许跨基地范围
|
||||
/// </summary>
|
||||
public bool IsCostCrossTenant { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据状态
|
||||
/// </summary>
|
||||
public BalanceRecordStatusEnumType Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据状态CN
|
||||
/// </summary>
|
||||
public string StatusCN => Status.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 消费时间
|
||||
/// </summary>
|
||||
public DateTime CostDateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐饮应用类型
|
||||
/// </summary>
|
||||
public CanteenApplicaitonTypeEnumType ApplicationType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐饮应用类型CN
|
||||
/// </summary>
|
||||
public string ApplicationTypeCN => ApplicationType.GetDescription();
|
||||
|
||||
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -38,4 +38,5 @@ public interface IBalanceService : IScopeDependency
|
||||
Task<Pagination<OaEMealVoucherResponse>> GetOaEMealVoucherAsync([FromQuery] OaEMealVoucherRequest request);
|
||||
|
||||
Task<Pagination<OaEMealVoucherDetailResponse>> GetOaEMealVoucherDetailAsync([FromQuery] OaEMealVoucherDetailRequest request);
|
||||
Task<Pagination<BalanceRecordByUserResponse>> BalanceRecordByUserAsync(BalanceRecordByUserRequest request);
|
||||
}
|
||||
|
||||
@@ -744,6 +744,16 @@ public class BalanceService : IBalanceService
|
||||
return page;
|
||||
}
|
||||
|
||||
public async Task<Pagination<BalanceRecordByUserResponse>> BalanceRecordByUserAsync(BalanceRecordByUserRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<BalanceRecordEntity>()
|
||||
.WhereIF(request.Search.IsPresent(), b => b.UserNo == request.Search || b.UserCode == request.Search)
|
||||
.Where(b => b.Source == BalanceRecordSourceEnumType.LocalTenantSubsidies || b.Source == BalanceRecordSourceEnumType.OtherTenantSubsidies)
|
||||
.Select<BalanceRecordByUserResponse>()
|
||||
.ToPageListAsync(request);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取离线设备
|
||||
@@ -845,7 +855,7 @@ public class BalanceService : IBalanceService
|
||||
public async Task<Pagination<OaEMealVoucherResponse>> GetOaEMealVoucherAsync(OaEMealVoucherRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<OaEMealVoucherEntity>()
|
||||
.Where(x => x.UserCode == request.UserCode)
|
||||
.WhereIF(request.Search.IsPresent(),x => x.UserCode.Contains(request.Search) || x.Name.Contains(request.Search))
|
||||
.Select<OaEMealVoucherResponse>()
|
||||
.ToPageListAsync(request);
|
||||
return page;
|
||||
@@ -854,7 +864,8 @@ public class BalanceService : IBalanceService
|
||||
public async Task<Pagination<OaEMealVoucherDetailResponse>> GetOaEMealVoucherDetailAsync(OaEMealVoucherDetailRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<OaEMealVoucherDetailEntity>()
|
||||
.Where(x => x.VoucherId == request.OaEMealVoucherId)
|
||||
.WhereIF(request.Search.IsPresent(),x => x.Name.Contains(request.Search))
|
||||
.WhereIF(request.OaEMealVoucherId.HasValue, x => x.VoucherId == request.OaEMealVoucherId)
|
||||
.Select<OaEMealVoucherDetailResponse>()
|
||||
.ToPageListAsync(request);
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using Dlhis.Common.Request;
|
||||
using Dlhis.Common.Response;
|
||||
using Dlhis.Common.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Common.MealSupplementRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// 餐补控制器
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class MealSupplementRecordController
|
||||
{
|
||||
private readonly IMealSupplementRecordService _mealSupplementRecordService;
|
||||
|
||||
public MealSupplementRecordController(IMealSupplementRecordService mealSupplementRecordService)
|
||||
{
|
||||
_mealSupplementRecordService = mealSupplementRecordService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 餐补分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("mealSupplementRecordPage")]
|
||||
public async Task<Pagination<MealSupplementRecordResponse>> MealSupplementRecordPageAsync([FromQuery]MealSupplementRecordRequest request)
|
||||
{
|
||||
return await _mealSupplementRecordService.MealSupplementRecordPageAsync(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Src/Dlhis.Common/Request/MealSupplementRecordRequest.cs
Normal file
9
Src/Dlhis.Common/Request/MealSupplementRecordRequest.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Common.Request
|
||||
{
|
||||
public class MealSupplementRecordRequest : PageDto
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
62
Src/Dlhis.Common/Response/MealSupplementRecordResponse.cs
Normal file
62
Src/Dlhis.Common/Response/MealSupplementRecordResponse.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using SqlSugar.DbConvert;
|
||||
using SqlSugar;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Common.Response
|
||||
{
|
||||
public class MealSupplementRecordResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 唯一号
|
||||
/// </summary>
|
||||
public string UniqueId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工号
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐补状态
|
||||
/// </summary>
|
||||
public MealSupplementStatusEnumtype Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐补状态CN
|
||||
/// </summary>
|
||||
public string StatusCN => Status.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 考勤日期
|
||||
/// </summary>
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工作地
|
||||
/// </summary>
|
||||
public string Workplace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 厂区
|
||||
/// </summary>
|
||||
public string Factory { get; set; }
|
||||
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐补
|
||||
/// </summary>
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 处理结果
|
||||
/// </summary>
|
||||
public string Result { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态同步
|
||||
/// </summary>
|
||||
public bool Sync { get; set; }
|
||||
}
|
||||
}
|
||||
11
Src/Dlhis.Common/Services/IMealSupplementRecordService.cs
Normal file
11
Src/Dlhis.Common/Services/IMealSupplementRecordService.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Dlhis.Common.Request;
|
||||
using Dlhis.Common.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Common.Services
|
||||
{
|
||||
public interface IMealSupplementRecordService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<MealSupplementRecordResponse>> MealSupplementRecordPageAsync(MealSupplementRecordRequest request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using Dlhis.Common.Request;
|
||||
using Dlhis.Common.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.Common.Services.Implements
|
||||
{
|
||||
public class MealSupplementRecordService : IMealSupplementRecordService
|
||||
{
|
||||
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public MealSupplementRecordService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<Pagination<MealSupplementRecordResponse>> MealSupplementRecordPageAsync(MealSupplementRecordRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<MealSupplementRecordEntity>()
|
||||
.WhereIF(request.Search.IsPresent(), x => x.Code.Contains(request.Search))
|
||||
.Select<MealSupplementRecordResponse>()
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,11 +21,11 @@ namespace Dlhis.ScheduledTask.CommonJobs;
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime todayStart = now.Date;
|
||||
DateTime threeDaysAgoStart = todayStart.AddDays(-3);
|
||||
DateTime threeDaysAgoStart = todayStart.AddDays(-7);
|
||||
|
||||
var logs = await _dbContext.ChangeDb("log")
|
||||
.Queryable<ApiLogEntity>()
|
||||
.Where(x => x._ts <= threeDaysAgoStart)
|
||||
.Where(x => x._ts >= threeDaysAgoStart && x._ts <= now)
|
||||
.Select(x => x.Id)
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class JobPack : BaseAppPack
|
||||
TimeZone = TimeZoneInfo.Local
|
||||
});
|
||||
//删除前三天前的日志
|
||||
RecurringJob.AddOrUpdate<DelApiLogTaskJob>("DelApiLogTask", s => s.RunAsync(), "0 0 2 * * *", new RecurringJobOptions
|
||||
RecurringJob.AddOrUpdate<DelApiLogTaskJob>("DelApiLogTask", s => s.RunAsync(), "0 0 */7 * *", new RecurringJobOptions
|
||||
{
|
||||
TimeZone = TimeZoneInfo.Local
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user