feat 配送点管理
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Basic.MealUser.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 订餐地址
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class BookingAddresController : ControllerBase
|
||||
{
|
||||
private readonly IBookingAddresService _bookingAddresService;
|
||||
|
||||
public BookingAddresController(IBookingAddresService bookingAddresService)
|
||||
{
|
||||
_bookingAddresService = bookingAddresService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 地址分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("pageAddres")]
|
||||
public async Task<Pagination<GetAddresPageResponse>> GetAddresPageAsync([FromQuery] GetAddresPageRequest request)
|
||||
{
|
||||
return await _bookingAddresService.GetAddresPageRequest(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 地址保存
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("saveAddres")]
|
||||
public async Task SaveAddresAsync(SaveAddresRequest request)
|
||||
{
|
||||
await _bookingAddresService.SaveAddresAsync(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Src/Dlhis.Basic/MealUser/Request/GetAddresPageRequest.cs
Normal file
8
Src/Dlhis.Basic/MealUser/Request/GetAddresPageRequest.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Request
|
||||
{
|
||||
public class GetAddresPageRequest : PageDto
|
||||
{
|
||||
}
|
||||
}
|
||||
16
Src/Dlhis.Basic/MealUser/Request/SaveAddresRequest.cs
Normal file
16
Src/Dlhis.Basic/MealUser/Request/SaveAddresRequest.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Request
|
||||
{
|
||||
public class SaveAddresRequest
|
||||
{
|
||||
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订餐地址
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "订餐地址")]
|
||||
public string Addres { get; set; }
|
||||
}
|
||||
}
|
||||
15
Src/Dlhis.Basic/MealUser/Response/GetAddresPageResponse.cs
Normal file
15
Src/Dlhis.Basic/MealUser/Response/GetAddresPageResponse.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Response
|
||||
{
|
||||
public class GetAddresPageResponse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订餐地址
|
||||
/// </summary>
|
||||
public string Addres { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
12
Src/Dlhis.Basic/MealUser/Services/IBookingAddresService.cs
Normal file
12
Src/Dlhis.Basic/MealUser/Services/IBookingAddresService.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Services
|
||||
{
|
||||
public interface IBookingAddresService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<GetAddresPageResponse>> GetAddresPageRequest(GetAddresPageRequest request);
|
||||
Task SaveAddresAsync(SaveAddresRequest request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Services.Implements
|
||||
{
|
||||
public class BookingAddresService : IBookingAddresService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public BookingAddresService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<Pagination<GetAddresPageResponse>> GetAddresPageRequest(GetAddresPageRequest request)
|
||||
{
|
||||
return await _dbContext.Queryable<BookingAddresEntity>()
|
||||
.WhereIF(request.Search.IsPresent(),x=>x.Addres.Contains(request.Search))
|
||||
.Select<GetAddresPageResponse>()
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
public async Task SaveAddresAsync(SaveAddresRequest request)
|
||||
{
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<BookingAddresEntity>();
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _dbContext.Queryable<BookingAddresEntity>()
|
||||
.Where(x => x.Id == request.Id)
|
||||
.FirstAsync();
|
||||
request.Adapt(entity);
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
Src/Dlhis.Entity/Basic/Entity/BookingAddresEntity.cs
Normal file
28
Src/Dlhis.Entity/Basic/Entity/BookingAddresEntity.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Kurisu.Core.DataAccess.Entity;
|
||||
using Kurisu.SqlSugar;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dlhis.Entity.Basic.Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 就餐地址
|
||||
/// </summary>
|
||||
[SugarTable(TableName = "BookingAddres", TableDescription = "就餐地址")]
|
||||
public class BookingAddresEntity : SugarBaseEntity, ITenantId
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 订餐地址
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "订餐地址")]
|
||||
public string Addres { get; set; }
|
||||
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ namespace Dlhis.Entity.Common;
|
||||
/// api日志表
|
||||
/// </summary>
|
||||
[SugarTable(TableName = "Logs", TableDescription = "api日志表")]
|
||||
public class ApiLogEntity : SugarBaseEntity
|
||||
public class ApiLogEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 时间
|
||||
|
||||
@@ -19,15 +19,15 @@ namespace Dlhis.ScheduledTask.CommonJobs;
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime todayStart = now.Date;
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime todayStart = now.Date;
|
||||
DateTime threeDaysAgoStart = todayStart.AddDays(-7);
|
||||
|
||||
var logs = await _dbContext.ChangeDb("log")
|
||||
.Queryable<ApiLogEntity>()
|
||||
var logs = await _dbContext.ChangeDb("log")
|
||||
.Queryable<ApiLogEntity>()
|
||||
.Where(x => x._ts >= threeDaysAgoStart && x._ts <= now)
|
||||
.Select(x => x.Id)
|
||||
.ToListAsync();
|
||||
.ToListAsync();
|
||||
|
||||
var lst = new List<ApiLogEntity>();
|
||||
foreach (var id in logs)
|
||||
|
||||
Reference in New Issue
Block a user