Squashed commit of the following:
commitafdd9e6f14Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 21:48:05 2024 +0800 fix 价格默认获取菜单中的设置 commita3cfc472c8Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 21:40:04 2024 +0800 fix 时间范围逻辑 commit83f8906f12Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 21:32:55 2024 +0800 fix 时间范围逻辑 commit35660b1d0cAuthor: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 21:29:36 2024 +0800 fix 数据范围罗逻辑修改 commit7407955bc5Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 21:14:06 2024 +0800 fix 分类树增加营业点参数 commited5196d1a1Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 21:02:52 2024 +0800 feat 用户创建 commitd25909a235Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 20:51:20 2024 +0800 fix 菜单明细调整 commit8915f9ff0fAuthor: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 20:42:08 2024 +0800 fix 判断提前 commit45aa52aa2aAuthor: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 20:34:22 2024 +0800 fix 逻辑取反 commit89904fead1Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 20:23:20 2024 +0800 fix 菜单时效范围 commit573911f907Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 19:13:33 2024 +0800 fix 订单聚合返回状态 commit93c38be18aAuthor: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 18:40:12 2024 +0800 fix 订单查询 commite256d18d36Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 18:14:33 2024 +0800 fix 订单取消接口,分页权限控制 commit1218aec811Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 17:32:45 2024 +0800 fix 营业点权限控制优化 commit226c61ee41Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 17:09:42 2024 +0800 fix tenantId赋值 commit28d2c1d8d4Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 17:05:37 2024 +0800 fix ignoretenant commit5ae6dd97b4Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 16:53:40 2024 +0800 fix ignoretenant commit4c866eaf3fAuthor: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 16:40:24 2024 +0800 feat 获取所有地址 commit2ca8f2db49Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 16:22:47 2024 +0800 fix 优化查询 commit212a1fa073Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 16:01:49 2024 +0800 fix 临时数据模拟 commit0eb76e878cAuthor: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 15:48:59 2024 +0800 fix 处理删除缺少判断 commitc582fb40c0Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 15:40:22 2024 +0800 fix 查询优化 commit6d3a19b283Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 11:48:45 2024 +0800 fix 错误值修改 commitc39f77008dAuthor: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 11:31:50 2024 +0800 fix 营业点控制(admin),unit返回 commita5dcab1d07Author: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 11:16:23 2024 +0800 fix 营业点分页控制 commit02084be82bAuthor: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 11:01:14 2024 +0800 fix 分类控制菜品获取 commit96c5c5febaAuthor: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 10:39:58 2024 +0800 fix DI commit367ede2eebAuthor: liguoyang <Ligy.97@foxmail.com> Date: Thu Mar 21 10:35:24 2024 +0800 fix 订餐返回当前信息,增加数量入参和响应 commit0e1f6cb4a0Author: liguoyang <Ligy.97@foxmail.com> Date: Wed Mar 20 16:40:10 2024 +0800 fix 餐补查询代码调整 commit21fc2f78d3Author: liguoyang <Ligy.97@foxmail.com> Date: Wed Mar 20 15:52:46 2024 +0800 fix 支付批量操作 commit878b44a146Merge:a90d4e6bf5c937Author: cheche <717840555@qq.com> Date: Wed Mar 20 15:27:39 2024 +0800 Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development commita90d4e66a7Author: cheche <717840555@qq.com> Date: Wed Mar 20 15:27:37 2024 +0800 fix 餐补查询及日志删除 commitbf5c937037Author: liguoyang <Ligy.97@foxmail.com> Date: Wed Mar 20 15:12:30 2024 +0800 fix 补充营业点分配权限接口 commit07672f1d32Author: liguoyang <Ligy.97@foxmail.com> Date: Wed Mar 20 13:56:33 2024 +0800 fix 优化changeDb commit7090ee4a33Author: liguoyang <Ligy.97@foxmail.com> Date: Wed Mar 20 13:41:25 2024 +0800 fix 敏感信息混淆 commit4366b68831Author: liguoyang <Ligy.97@foxmail.com> Date: Wed Mar 20 12:42:48 2024 +0800 fix 代码优化 commit03b73515b5Author: liguoyang <Ligy.97@foxmail.com> Date: Wed Mar 20 10:59:08 2024 +0800 fix tree返回营业点 commit1ce60bedc2Merge:aba4fa72d83930Author: cheche <717840555@qq.com> Date: Wed Mar 20 09:55:17 2024 +0800 Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development commitaba4fa7ee9Author: cheche <717840555@qq.com> Date: Wed Mar 20 09:55:13 2024 +0800 fix 删除日志优化 commit2d8393068fAuthor: liguoyang <Ligy.97@foxmail.com> Date: Tue Mar 19 20:53:16 2024 +0800 feat 订单聚合接口 commit0cde1d3d92Author: liguoyang <Ligy.97@foxmail.com> Date: Tue Mar 19 20:03:06 2024 +0800 fix 表名称调整 commitf003e30169Author: liguoyang <Ligy.97@foxmail.com> Date: Tue Mar 19 19:51:56 2024 +0800 fix 订餐null异常处理 commitf427338715Author: liguoyang <Ligy.97@foxmail.com> Date: Tue Mar 19 18:43:19 2024 +0800 feat 获取菜品 commit3a65d95701Merge:9a7091b7432faeAuthor: cheche <717840555@qq.com> Date: Tue Mar 19 18:36:16 2024 +0800 Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development commit9a7091b4e0Author: cheche <717840555@qq.com> Date: Tue Mar 19 18:36:14 2024 +0800 fix 删除日志try commit7432fae103Author: liguoyang <Ligy.97@foxmail.com> Date: Tue Mar 19 18:02:31 2024 +0800 fix 配送点增加 commitecd162c7afAuthor: liguoyang <Ligy.97@foxmail.com> Date: Tue Mar 19 17:51:15 2024 +0800 fix 预定就餐送货地点 commit1c7a054ed4Author: liguoyang <Ligy.97@foxmail.com> Date: Tue Mar 19 15:53:22 2024 +0800 feat 获取所有营业点接口 commit84398a566eMerge:217d9f784b4025Author: cheche <717840555@qq.com> Date: Tue Mar 19 15:26:42 2024 +0800 Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development commit217d9f7770Author: cheche <717840555@qq.com> Date: Tue Mar 19 15:26:40 2024 +0800 feat 配送点管理 commit84b402538eAuthor: liguoyang <Ligy.97@foxmail.com> Date: Tue Mar 19 14:59:21 2024 +0800 fix 菜单分页响应调整,增加详情接口 commit098d7c7e9dAuthor: liguoyang <Ligy.97@foxmail.com> Date: Tue Mar 19 14:26:24 2024 +0800 fix 代码优化
This commit is contained in:
@@ -10,4 +10,8 @@
|
||||
<PackageReference Include="Kurisu.RemoteCall" Version="0.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Response\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dlhis.Basic.Api.Response
|
||||
namespace Dlhis.Basic.Api.Dtos
|
||||
{
|
||||
public class BusinessPlaceDto
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
using Dlhis.Basic.Api.Response;
|
||||
using Dlhis.Basic.Api.Dtos;
|
||||
using Kurisu.Core.Result;
|
||||
using Kurisu.RemoteCall.Attributes;
|
||||
|
||||
@@ -9,5 +9,5 @@ public interface IBusinessPlacePermissionsApi
|
||||
{
|
||||
[Auth]
|
||||
[Get("/api/businessplacepermissions/my")]
|
||||
Task<DefaultApiResult<GetMyResponse>> GetMyAsync();
|
||||
Task<DefaultApiResult<List<BusinessPlaceDto>>> GetMyAsync();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@ public interface IDisheMenuApi
|
||||
/// <param name="dishesCode"></param>
|
||||
/// <returns></returns>
|
||||
[Auth]
|
||||
[Get("/api/dishesMenus/detail")]
|
||||
[Get("/api/dishesMenus/checkdetail")]
|
||||
Task<DefaultApiResult<DishesMenuDetailDto>> GetBookingDishesDetailAsync(DateTime date, Guid businessPlaceCode, int shiftType, string dishesCode);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dlhis.Basic.Api.Response
|
||||
{
|
||||
public class GetMyResponse
|
||||
{
|
||||
public List<BusinessPlaceDto> dtos { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Request;
|
||||
|
||||
public class SaveBusinessPlacePermissionRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理人员userId
|
||||
/// </summary>
|
||||
public int UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Dlhis.Basic.BusinessPlace.Response
|
||||
{
|
||||
public class BusinessPlaceDto
|
||||
{
|
||||
public Guid Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Dlhis.Basic.BusinessPlace.Response
|
||||
{
|
||||
public class GetMyResponse
|
||||
{
|
||||
public List<BusinessPlaceDto> dtos { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Services;
|
||||
|
||||
public interface IBusinessPlacePermissionsService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<BusinessPlacePermissionPageResponse>> GetPageAsync(BusinessPlacePermissionPageRequest request);
|
||||
|
||||
Task SaveBusinessPlacePermissionAsync(SaveBusinessPlacePermissionRequest request);
|
||||
|
||||
Task<GetMyResponse> GetMyAsync();
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Services.Implements;
|
||||
|
||||
public class BusinessPlacePermissionsService : IBusinessPlacePermissionsService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly ICurrentUser _currentUser;
|
||||
|
||||
public BusinessPlacePermissionsService(IDbContext dbContext, ICurrentUser currentUser)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_currentUser = currentUser;
|
||||
}
|
||||
|
||||
public async Task<Pagination<BusinessPlacePermissionPageResponse>> GetPageAsync(BusinessPlacePermissionPageRequest request)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task<GetMyResponse> GetMyAsync()
|
||||
{
|
||||
var userId = _currentUser.GetIntSubjectId();
|
||||
|
||||
var guids = await _dbContext.Queryable<BusinessPlaceManagerRelationshipEntity>()
|
||||
.Where(x => x.ManagerUserId == userId)
|
||||
.Select(x => x.BusinessPlaceCode)
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
|
||||
var dtos = await _dbContext.Queryable<BusinessPlaceEntity>()
|
||||
.Where(x => guids.Contains(x.Code))
|
||||
.Select<BusinessPlaceDto>()
|
||||
.ToListAsync();
|
||||
var myResponse = new GetMyResponse
|
||||
{
|
||||
dtos = dtos
|
||||
};
|
||||
return myResponse;
|
||||
}
|
||||
|
||||
public async Task SaveBusinessPlacePermissionAsync(SaveBusinessPlacePermissionRequest request)
|
||||
{
|
||||
var userId = _currentUser.GetIntSubjectId();
|
||||
if (request.Id.HasValue)
|
||||
{
|
||||
var entity = await _dbContext.Queryable<BusinessPlaceManagerRelationshipEntity>()
|
||||
.Where(x => x.Id == request.Id).FirstAsync();
|
||||
|
||||
request.Adapt(entity);
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = request.Adapt<BusinessPlaceManagerRelationshipEntity>();
|
||||
entity.ManagerUserId = userId;
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.Dishes.Response;
|
||||
using Dlhis.Basic.Dishes.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -24,11 +25,25 @@ public class DishesCategoriesController : ControllerBase
|
||||
/// <summary>
|
||||
/// 获取分类树
|
||||
/// </summary>
|
||||
/// <param name="businessPlaceCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree")]
|
||||
public async Task<List<DishesCategoryTreeResponse>> TreeAsync()
|
||||
public async Task<List<DishesCategoryTreeResponse>> TreeAsync(Guid businessPlaceCode)
|
||||
{
|
||||
return await _dishesCategoryService.TreeAsync();
|
||||
return await _dishesCategoryService.TreeAsync(businessPlaceCode);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取分类树(无权限)
|
||||
/// </summary>
|
||||
/// <param name="businessPlaceCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree-all")]
|
||||
[IgnoreTenant]
|
||||
public async Task<List<DishesCategoryTreeResponse>> TreeAllAsync(Guid businessPlaceCode)
|
||||
{
|
||||
return await _dishesCategoryService.TreeAllAsync(businessPlaceCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -38,6 +38,38 @@ public class DishesMenusController : ControllerBase
|
||||
return await _dishesMenuService.GetDishesMenuPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 菜单详情
|
||||
/// </summary>
|
||||
/// <param name="businessPlaceCode"></param>
|
||||
/// <param name="customCode"></param>
|
||||
/// <param name="startDate"></param>
|
||||
/// <param name="endDate"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
public async Task<DishesMenuSaveRequest> GetDishesMenuDetailAsync(Guid businessPlaceCode, string customCode, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
return await _dishesMenuService.GetDishesMenuDetailAsync(businessPlaceCode, customCode, startDate, endDate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据参数获取菜品
|
||||
/// </summary>
|
||||
/// <param name="businessPlaceCode"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="shiftType"></param>
|
||||
/// <param name="categoryCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("dishes-selections")]
|
||||
[IgnoreTenant]
|
||||
public async Task<List<DishesDetailResponse>> GetDishesUnderCurrentMenuAsync(Guid businessPlaceCode,
|
||||
DateTime date,
|
||||
ShiftEnumType? shiftType,
|
||||
Guid categoryCode)
|
||||
{
|
||||
return await _dishesMenuService.GetDishesUnderCurrentMenuAsync(businessPlaceCode, date, shiftType, categoryCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 菜单保存/更改
|
||||
/// </summary>
|
||||
@@ -51,14 +83,15 @@ public class DishesMenusController : ControllerBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 菜单明细
|
||||
/// 检查明细
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="businessPlaceCode"></param>
|
||||
/// <param name="shiftType"></param>
|
||||
/// <param name="dishesCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
[HttpGet("checkdetail")]
|
||||
[IgnoreTenant]
|
||||
public async Task<DishesMenuDetailDto> GetBookingDishesDetailAsync(DateTime date, Guid businessPlaceCode, ShiftEnumType shiftType, string dishesCode)
|
||||
{
|
||||
return await _dishesMenuService.GetBookingDishesDetailAsync(date, businessPlaceCode, shiftType, dishesCode);
|
||||
@@ -103,7 +136,8 @@ public class DishesMenusController : ControllerBase
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("setting")]
|
||||
public async Task<GetDishesMenusBookingResponse> GetDishesMenusBookingSetting([FromQuery] GetDishesMenusBookingRequest request)
|
||||
[IgnoreTenant]
|
||||
public async Task<DishesMenusBookingSettingResponse> GetDishesMenusBookingSetting([FromQuery] GetDishesMenusBookingRequest request)
|
||||
{
|
||||
return await _dishesService.GetDishesMenusBookingSetting(request);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Request;
|
||||
|
||||
@@ -9,14 +8,4 @@ public class DisheMenuPageRequest : PageDto
|
||||
/// 营业点code
|
||||
/// </summary>
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
public List<ShiftEnumType> ShiftTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类
|
||||
/// </summary>
|
||||
public Guid? CategoryCode { get; set; }
|
||||
}
|
||||
|
||||
@@ -6,6 +6,13 @@ public class DishesCategorySaveRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
[Required]
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PCode
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.CustomClass;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Request;
|
||||
|
||||
@@ -11,29 +12,26 @@ public class DishesMenuNameDateSaveRequest : IValidatableObject
|
||||
public string CustomCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单日期
|
||||
/// 时间段
|
||||
/// </summary>
|
||||
public DateTime Date { get; set; }
|
||||
[Required(ErrorMessage = "时间段不可为空")]
|
||||
public DateTimePeriod Period { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次数据
|
||||
/// </summary>
|
||||
public List<DishesMenuShiftTypeSaveRequest> ShiftTypes { get; set; }
|
||||
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (Date < DateTime.Today)
|
||||
if (Period.Start > Period.End)
|
||||
{
|
||||
yield return new ValidationResult("菜单日期不能小于当天");
|
||||
yield return new ValidationResult("时间范围有误", new[] { nameof(Period) });
|
||||
}
|
||||
|
||||
//格式化
|
||||
Date = Date.Date;
|
||||
|
||||
if (CustomCode.IsEmpty())
|
||||
{
|
||||
CustomCode = Date.ToString("yyyy-MM-dd");
|
||||
CustomCode = Period.Start.Value.ToString("yyyy-MM-dd") + "." + Period.End.Value.ToString("yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
namespace Dlhis.Basic.Dishes.Request
|
||||
{
|
||||
public class GetDishesMenusBookingRequest
|
||||
{
|
||||
public Guid PlaceCode { get; set; }
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
public string Factory { get; set; }
|
||||
}
|
||||
namespace Dlhis.Basic.Dishes.Request;
|
||||
|
||||
public class GetDishesMenusBookingRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "请选择营业点")]
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Response
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
|
||||
public class BalanceRecordSourceEnumDto
|
||||
{
|
||||
public class BalanceRecordSourceEnumDto
|
||||
{
|
||||
public BalanceRecordSourceEnumType Type { get; set; }
|
||||
public string TypeCN => Type.GetDescription();
|
||||
}
|
||||
|
||||
public string TypeDesc => Type.GetDescription();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Response
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
|
||||
public class BusinessShiftMealRelationshipResponse
|
||||
{
|
||||
public class BusinessShiftMealRelationshipResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 餐别Code
|
||||
/// </summary>
|
||||
@@ -23,7 +23,6 @@ namespace Dlhis.Basic.Dishes.Response
|
||||
/// <summary>
|
||||
/// 餐次CN
|
||||
/// </summary>
|
||||
public string ShiftTypeCN => ShiftType.GetDescription();
|
||||
public string ShiftTypeDesc => ShiftType.GetDescription();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
public class DishesCategoryTreeResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 营业点code
|
||||
/// </summary>
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
|
||||
public Guid? PCode { get; set; }
|
||||
|
||||
public Guid Code { get; set; }
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
|
||||
public class DishesDetailResponse
|
||||
{
|
||||
@@ -32,12 +35,30 @@ public class DishesDetailResponse
|
||||
/// <summary>
|
||||
/// 单价
|
||||
/// </summary>
|
||||
public decimal Price { get; set; }
|
||||
public decimal? Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 剩余数量
|
||||
/// </summary>
|
||||
public int Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public List<string> Units { get; set; }
|
||||
public List<string> Units
|
||||
{
|
||||
get
|
||||
{
|
||||
if (CurrentUnits.IsPresent())
|
||||
{
|
||||
return CurrentUnits.ToObject<List<string>>();
|
||||
}
|
||||
return new() { "个" };
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string CurrentUnits { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图片
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
|
||||
public class DishesMenuPageResponse
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单编码
|
||||
/// </summary>
|
||||
@@ -17,35 +13,12 @@ public class DishesMenuPageResponse
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业日期
|
||||
/// 营业日期 开始
|
||||
/// </summary>
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public DateTime StartDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// 营业日期 结束
|
||||
/// </summary>
|
||||
public ShiftEnumType ShiftType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 菜品编码
|
||||
/// </summary>
|
||||
public string DishesCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 剩余数量
|
||||
/// </summary>
|
||||
public int Number { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 单价
|
||||
/// </summary>
|
||||
public decimal? Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool Enable { get; set; }
|
||||
public DateTime EndDate { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Dlhis.Basic.Dishes.Response;
|
||||
|
||||
public class DishesMenusBookingSettingResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务端时间
|
||||
/// </summary>
|
||||
public DateTime ServerTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订餐期限
|
||||
/// </summary>
|
||||
public DateTime Deadline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 支付方式
|
||||
/// </summary>
|
||||
public List<BalanceRecordSourceEnumDto> PayTypes { get; set; }
|
||||
}
|
||||
@@ -5,6 +5,8 @@ namespace Dlhis.Basic.Dishes.Response;
|
||||
|
||||
public class DishesResponse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类
|
||||
/// </summary>
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using SqlSugar.DbConvert;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Response
|
||||
{
|
||||
public class GetDishesMenusBookingResponse
|
||||
{
|
||||
public List<BusinessShiftMealRelationshipResponse> BusinessShiftMealRelationships { get; set; }
|
||||
|
||||
public DateTime ServiceTime { get; set; }
|
||||
|
||||
public List<BalanceRecordSourceEnumDto> PayTypes { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,11 @@ namespace Dlhis.Basic.Dishes.Services;
|
||||
|
||||
public interface IDishesCategoryService : IScopeDependency
|
||||
{
|
||||
Task<List<DishesCategoryTreeResponse>> TreeAsync();
|
||||
Task<List<DishesCategoryTreeResponse>> TreeAsync(Guid businessPlaceCode);
|
||||
|
||||
|
||||
Task<List<DishesCategoryTreeResponse>> TreeAllAsync(Guid businessPlaceCode);
|
||||
|
||||
|
||||
Task SaveAsync(DishesCategorySaveRequest request);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@ public interface IDishesMenuService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<DishesMenuPageResponse>> GetDishesMenuPageAsync(DisheMenuPageRequest request);
|
||||
|
||||
Task<DishesMenuSaveRequest> GetDishesMenuDetailAsync(Guid businessPlaceCode, string customCode, DateTime startDate, DateTime endDate);
|
||||
|
||||
Task<List<DishesDetailResponse>> GetDishesUnderCurrentMenuAsync(Guid businessPlaceCode, DateTime date, ShiftEnumType? shiftType, Guid categoryCode);
|
||||
|
||||
Task SaveDishesMenuAsync(DishesMenuSaveRequest request);
|
||||
|
||||
Task<DishesMenuDetailDto> GetBookingDishesDetailAsync(DateTime date, Guid businessPlaceCode, ShiftEnumType shiftType, string dishesCode);
|
||||
|
||||
@@ -12,6 +12,6 @@ public interface IDishesService : IScopeDependency
|
||||
|
||||
Task<DishesDetailResponse> GetDishesDetailByIdAsync(long id);
|
||||
|
||||
Task<GetDishesMenusBookingResponse> GetDishesMenusBookingSetting(GetDishesMenusBookingRequest request);
|
||||
Task<DishesMenusBookingSettingResponse> GetDishesMenusBookingSetting(GetDishesMenusBookingRequest request);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Services;
|
||||
using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.Dishes.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
@@ -10,15 +12,31 @@ namespace Dlhis.Basic.Dishes.Services.Implements;
|
||||
public class DishesCategoryService : IDishesCategoryService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly IBusinessPlacePermissionsService _businessPlacePermissionsService;
|
||||
|
||||
public DishesCategoryService(IDbContext dbContext)
|
||||
public DishesCategoryService(IDbContext dbContext, IBusinessPlacePermissionsService businessPlacePermissionsService)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_businessPlacePermissionsService = businessPlacePermissionsService;
|
||||
}
|
||||
|
||||
public async Task<List<DishesCategoryTreeResponse>> TreeAsync()
|
||||
public async Task<List<DishesCategoryTreeResponse>> TreeAsync(Guid businessPlaceCode)
|
||||
{
|
||||
var categories = await _dbContext.Queryable<DishesCategoryEntity>().Select<DishesCategoryTreeResponse>().ToListAsync();
|
||||
var mybCodes = await GetMyBusinessPlaceCodesAsync();
|
||||
mybCodes = mybCodes.Where(x => x == businessPlaceCode).ToList();
|
||||
|
||||
var categories = await _dbContext.Queryable<DishesCategoryEntity>()
|
||||
.LeftJoin<BusinessPlaceEntity>((x, bplace) => x.BusinessPlaceCode == bplace.Code)
|
||||
.Where(x => mybCodes.Contains(x.BusinessPlaceCode))
|
||||
.Select((x, bplace) => new DishesCategoryTreeResponse
|
||||
{
|
||||
BusinessPlaceCode = bplace.Code,
|
||||
Code = x.Code,
|
||||
Name = x.Name,
|
||||
PCode = x.PCode,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var tops = categories.Where(x => !x.PCode.HasValue).ToList();
|
||||
|
||||
tops.ForEach(x =>
|
||||
@@ -29,8 +47,36 @@ public class DishesCategoryService : IDishesCategoryService
|
||||
return tops;
|
||||
}
|
||||
|
||||
public async Task<List<DishesCategoryTreeResponse>> TreeAllAsync(Guid businessPlaceCode)
|
||||
{
|
||||
var categories = await _dbContext.Queryable<DishesCategoryEntity>()
|
||||
.LeftJoin<BusinessPlaceEntity>((x, bplace) => x.BusinessPlaceCode == bplace.Code)
|
||||
.Where(x => x.BusinessPlaceCode == businessPlaceCode)
|
||||
.Select((x, bplace) => new DishesCategoryTreeResponse
|
||||
{
|
||||
BusinessPlaceCode = bplace.Code,
|
||||
Code = x.Code,
|
||||
Name = x.Name,
|
||||
PCode = x.PCode,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var tops = categories.Where(x => !x.PCode.HasValue).ToList();
|
||||
|
||||
tops.ForEach(x =>
|
||||
{
|
||||
RecursionGetNext(x, categories);
|
||||
});
|
||||
|
||||
return tops;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task SaveAsync(DishesCategorySaveRequest request)
|
||||
{
|
||||
await CheckBusinessPlacePermissionAsync(request.BusinessPlaceCode);
|
||||
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<DishesCategoryEntity>();
|
||||
@@ -62,4 +108,27 @@ public class DishesCategoryService : IDishesCategoryService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查营业点权限
|
||||
/// </summary>
|
||||
/// <param name="businessPlaceCode"></param>
|
||||
/// <returns></returns>
|
||||
private async Task CheckBusinessPlacePermissionAsync(Guid businessPlaceCode)
|
||||
{
|
||||
var codes = await GetMyBusinessPlaceCodesAsync();
|
||||
codes.Contains(businessPlaceCode).ThrowIfFalse("无权操作当前营业点");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取我管理的营业点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task<List<Guid>> GetMyBusinessPlaceCodesAsync()
|
||||
{
|
||||
var mybCodes = (await _businessPlacePermissionsService.GetMyAsync()).Select(x => x.Code).ToList();
|
||||
|
||||
return mybCodes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.Dishes.Response;
|
||||
using Dlhis.Basic.BusinessPlace.Services;
|
||||
using Dlhis.Basic.Dishes.Dto;
|
||||
using Kurisu.Core.CustomClass;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Services.Implements;
|
||||
|
||||
@@ -26,10 +28,96 @@ public class DishesMenuService : IDishesMenuService
|
||||
public async Task<Pagination<DishesMenuPageResponse>> GetDishesMenuPageAsync(DisheMenuPageRequest request)
|
||||
{
|
||||
return await _dbContext.Queryable<DishesMenuEntity>()
|
||||
.Select<DishesMenuPageResponse>()
|
||||
.Where(x => x.BusinessPlaceCode == request.BusinessPlaceCode)
|
||||
.GroupBy(x => new { x.BusinessPlaceCode, x.CustomCode, x.StartDate, x.EndDate })
|
||||
.Select(x => new DishesMenuPageResponse
|
||||
{
|
||||
BusinessPlaceCode = x.BusinessPlaceCode,
|
||||
CustomCode = x.CustomCode,
|
||||
StartDate = x.StartDate,
|
||||
EndDate = x.EndDate,
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
public async Task<DishesMenuSaveRequest> GetDishesMenuDetailAsync(Guid businessPlaceCode, string customCode, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
var data = await _dbContext.Queryable<DishesMenuEntity>()
|
||||
.Where(x => x.BusinessPlaceCode == businessPlaceCode)
|
||||
.Where(x => x.CustomCode == customCode)
|
||||
.Where(x => x.StartDate == startDate)
|
||||
.Where(x => x.EndDate == endDate)
|
||||
.ToListAsync();
|
||||
|
||||
if (data.IsEmpty())
|
||||
{
|
||||
return new DishesMenuSaveRequest
|
||||
{
|
||||
BusinessPlaceCode = businessPlaceCode,
|
||||
Items = new List<DishesMenuNameDateSaveRequest> { }
|
||||
};
|
||||
}
|
||||
|
||||
return new DishesMenuSaveRequest
|
||||
{
|
||||
BusinessPlaceCode = businessPlaceCode,
|
||||
Items = new List<DishesMenuNameDateSaveRequest>
|
||||
{
|
||||
new()
|
||||
{
|
||||
CustomCode = customCode,
|
||||
Period = new DateTimePeriod
|
||||
{
|
||||
Start = data[0].StartDate,
|
||||
End = data[0].EndDate,
|
||||
},
|
||||
ShiftTypes = data.GroupBy(x => x.ShiftType).Select(item =>
|
||||
{
|
||||
var shiftType = item.Key;
|
||||
|
||||
return new DishesMenuShiftTypeSaveRequest
|
||||
{
|
||||
ShiftType = shiftType,
|
||||
Dishes = item.Select(x => new MenuDishesSaveRequest
|
||||
{
|
||||
DishesCode = x.DishesCode,
|
||||
Number = x.Number,
|
||||
Price = x.Price,
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
}).ToList()
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<List<DishesDetailResponse>> GetDishesUnderCurrentMenuAsync(Guid businessPlaceCode, DateTime date, ShiftEnumType? shiftType, Guid categoryCode)
|
||||
{
|
||||
var data = await _dbContext.Queryable<DishesMenuEntity>()
|
||||
.LeftJoin<DishesEntity>((x, dishes) => x.DishesCode == dishes.CustomCode)
|
||||
.Where(x => x.BusinessPlaceCode == businessPlaceCode)
|
||||
.Where(x => x.StartDate <= date && date <= x.EndDate)
|
||||
.Where((x, dishes) => dishes.Enable)
|
||||
.WhereIF(shiftType.HasValue, x => x.ShiftType == shiftType)
|
||||
.Where((x, dishes) => dishes.CategoryCode == categoryCode)
|
||||
.Select((x, dishes) => new DishesDetailResponse
|
||||
{
|
||||
BusinessPlaceCode = x.BusinessPlaceCode,
|
||||
CategoryCode = dishes.CategoryCode,
|
||||
CustomCode = dishes.CustomCode,
|
||||
Description = dishes.Description,
|
||||
ImageUrl = dishes.ImageUrl,
|
||||
Price = SqlFunc.IIF(x.Price > 0, x.Price, dishes.Price),
|
||||
Name = dishes.Name,
|
||||
Number = x.Number,
|
||||
CurrentUnits = dishes.Units.ToString()
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task SaveDishesMenuAsync(DishesMenuSaveRequest request)
|
||||
{
|
||||
//检验数据
|
||||
@@ -37,14 +125,26 @@ public class DishesMenuService : IDishesMenuService
|
||||
|
||||
//检验权限
|
||||
var res = await _businessPlacePermissionsService.GetMyAsync();
|
||||
var myBps = res.dtos.Select(x => x.Code).ToList();
|
||||
var myBps = res.Select(x => x.Code).ToList();
|
||||
|
||||
myBps.Contains(request.BusinessPlaceCode).ThrowIfFalse("非经营营业点,无法保存菜单");
|
||||
|
||||
if (request.Items.Any())
|
||||
{
|
||||
Expression<Func<DishesMenuEntity, bool>> whereCheck = LinqExpressionExtension.False<DishesMenuEntity>();
|
||||
request.Items.ForEach(p =>
|
||||
{
|
||||
whereCheck = whereCheck.Or(x => !(x.EndDate < p.Period.Start || x.StartDate > p.Period.End));
|
||||
});
|
||||
|
||||
var duplicate = await _dbContext.Queryable<DishesMenuEntity>().Where(whereCheck).AnyAsync();
|
||||
duplicate.ThrowIfTrue("菜单时效冲突");
|
||||
}
|
||||
|
||||
var entities = request.Items.SelectMany(item =>
|
||||
{
|
||||
var customCode = item.CustomCode;
|
||||
var date = item.Date;
|
||||
var period = item.Period;
|
||||
|
||||
return item.ShiftTypes.SelectMany(shiftTypeItem =>
|
||||
{
|
||||
@@ -60,7 +160,8 @@ public class DishesMenuService : IDishesMenuService
|
||||
{
|
||||
BusinessPlaceCode = request.BusinessPlaceCode,
|
||||
CustomCode = customCode,
|
||||
Date = date,
|
||||
StartDate = period.Start.Value,
|
||||
EndDate = period.End.Value,
|
||||
ShiftType = shiftType,
|
||||
DishesCode = dishesCode,
|
||||
Number = number,
|
||||
@@ -68,37 +169,37 @@ public class DishesMenuService : IDishesMenuService
|
||||
|
||||
Type = CanteenApplicaitonTypeEnumType.Booking,
|
||||
Version = 0,
|
||||
Enable = true,
|
||||
};
|
||||
});
|
||||
});
|
||||
}).ToList();
|
||||
|
||||
var keys = entities.DistinctBy(x => new { x.Date, x.ShiftType }).Select(x => new { x.Date, x.ShiftType }).ToList();
|
||||
var keys = entities.DistinctBy(x => new { x.StartDate, x.EndDate, x.ShiftType }).Select(x => new { x.StartDate, x.EndDate, x.ShiftType }).ToList();
|
||||
var where = LinqExpressionExtension.False<DishesMenuEntity>();
|
||||
keys.ForEach(x =>
|
||||
{
|
||||
where = where.Or(item => item.Date == x.Date && item.ShiftType == x.ShiftType);
|
||||
where = where.Or(item => item.BusinessPlaceCode == request.BusinessPlaceCode
|
||||
&& SqlFunc.DateIsSame(item.StartDate, x.StartDate, DateType.Day)
|
||||
&& SqlFunc.DateIsSame(item.EndDate, x.EndDate, DateType.Day)
|
||||
&& item.ShiftType == x.ShiftType);
|
||||
});
|
||||
|
||||
await _dbContext.Client.Deleteable<DishesMenuEntity>().Where(where).ExecuteCommandAsync();
|
||||
await _dbContext.InsertAsync(entities);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<DishesMenuDetailDto> GetBookingDishesDetailAsync(DateTime date, Guid businessPlaceCode, ShiftEnumType shiftType, string dishesCode)
|
||||
{
|
||||
var detail = await _dbContext.Queryable<DishesMenuEntity>()
|
||||
.LeftJoin<DishesEntity>((x, d) => x.DishesCode == d.CustomCode)
|
||||
.Where(x => x.Date == date)
|
||||
.Where(x => x.StartDate <= date && date <= x.EndDate)
|
||||
.Where(x => x.BusinessPlaceCode == businessPlaceCode)
|
||||
.Where(x => x.ShiftType == shiftType)
|
||||
.Where(x => x.DishesCode == dishesCode)
|
||||
.Where((x, d) => d.Enable)
|
||||
.Select((x, d) => new DishesMenuDetailDto
|
||||
{
|
||||
Date = x.Date,
|
||||
Date = date,
|
||||
MenuId = x.Id,
|
||||
DishesId = d.Id,
|
||||
DishesCode = d.CustomCode,
|
||||
@@ -116,11 +217,11 @@ public class DishesMenuService : IDishesMenuService
|
||||
|
||||
private static void CheckDuplicateData(DishesMenuSaveRequest request)
|
||||
{
|
||||
(request.Items.DistinctBy(x => new { x.CustomCode, x.Date }).Count() != request.Items.Count).ThrowIfTrue("菜单不可重复");
|
||||
(request.Items.DistinctBy(x => new { x.CustomCode, x.Period.Start, x.Period.End }).Count() != request.Items.Count).ThrowIfTrue("菜单不可重复");
|
||||
|
||||
foreach (var item in request.Items)
|
||||
{
|
||||
var u = item.Date.ToString("yyyy-MM-dd") + "-" + item.CustomCode;
|
||||
var u = item.Period.Start.Value.ToString("yyyy-MM-dd") + "." + item.Period.End.Value.ToString("yyyy-MM-dd") + "." + item.CustomCode;
|
||||
|
||||
(item.ShiftTypes.DistinctBy(x => x.ShiftType).Count() != item.ShiftTypes.Count).ThrowIfTrue($"{u}的餐次不可重复添加");
|
||||
|
||||
|
||||
@@ -1,40 +1,44 @@
|
||||
using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Services;
|
||||
using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.Dishes.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Services.Implements;
|
||||
|
||||
public class DishesService : IDishesService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ICurrentUser _currentUser;
|
||||
private readonly IBusinessPlacePermissionsService _businessPlacePermissionsService;
|
||||
|
||||
public DishesService(IDbContext dbContext, IConfiguration configuration)
|
||||
public DishesService(IDbContext dbContext, ICurrentUser currentUser, IBusinessPlacePermissionsService businessPlacePermissionsService)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_configuration = configuration;
|
||||
_currentUser = currentUser;
|
||||
_businessPlacePermissionsService = businessPlacePermissionsService;
|
||||
}
|
||||
|
||||
public async Task<Pagination<DishesResponse>> GetDishesPageAsync(DishesPageRequest request)
|
||||
{
|
||||
//todo 营业点权限
|
||||
var myCodes = await GetMyBusinessPlaceCodesAsync();
|
||||
|
||||
return await _dbContext.Queryable<DishesEntity>()
|
||||
.LeftJoin<DishesCategoryEntity>((x, category) => x.CategoryCode == category.Code)
|
||||
.WhereIF(request.Search.IsPresent(), x => x.CustomCode == request.Search || x.Name.Contains(request.Search))
|
||||
.WhereIF(request.BusinessPlaceCodes.IsPresent(), x => request.BusinessPlaceCodes.Contains(x.BusinessPlaceCode))
|
||||
.Where(x => myCodes.Contains(x.BusinessPlaceCode))
|
||||
.OrderBy(x => x.CreateTime, SqlSugar.OrderByType.Desc)
|
||||
.Select((x, category) => new DishesResponse
|
||||
{
|
||||
Id = x.Id,
|
||||
CurrnetUnits = x.Units.ToString(),
|
||||
CategoryName = category.Name,
|
||||
|
||||
@@ -61,53 +65,45 @@ public class DishesService : IDishesService
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<GetDishesMenusBookingResponse> GetDishesMenusBookingSetting(GetDishesMenusBookingRequest request)
|
||||
public async Task<DishesMenusBookingSettingResponse> GetDishesMenusBookingSetting(GetDishesMenusBookingRequest request)
|
||||
{
|
||||
var subjectId = _currentUser.GetIntSubjectId();
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdentityUserId == subjectId).FirstAsync();
|
||||
var jinkoCode = _currentUser.GetUserClaim("jinko-code") ?? string.Empty;
|
||||
if (jinkoCode.IsPresent())
|
||||
{
|
||||
gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == jinkoCode).FirstAsync();
|
||||
}
|
||||
|
||||
// 读取最晚订餐的时间
|
||||
var strDatetime = await _dbContext.Queryable<CanteenSettingEntity>()
|
||||
var value = await _dbContext.Queryable<CanteenSettingEntity>()
|
||||
.Where(x => x.UniqueType == CanteenSettingUnqiueEnumType.Tenant && x.Item == CanteenSettingItemEnumType.BookingDeadline && x.Enable)
|
||||
.Select(x => x.Value)
|
||||
.FirstAsync();
|
||||
|
||||
DateTime dateTime;
|
||||
DateTime.TryParseExact(strDatetime, "HH:mm:ss", null, System.Globalization.DateTimeStyles.None, out dateTime);
|
||||
if (!TimeOnly.TryParse(value, out var deadline))
|
||||
deadline = new TimeOnly(8, 30);
|
||||
|
||||
var res = new GetDishesMenusBookingResponse
|
||||
{
|
||||
ServiceTime = dateTime,
|
||||
};
|
||||
|
||||
var shift = await _dbContext.Queryable<BusinessPlaceShiftRelationshipEntity>()
|
||||
.Where(x => x.PlaceCode == request.PlaceCode)
|
||||
|
||||
var payTypes = new List<BalanceRecordSourceEnumDto>() { new() { Type = BalanceRecordSourceEnumType.Cash } };
|
||||
|
||||
var selectTenantId = await _dbContext.Queryable<BusinessPlaceEntity>()
|
||||
.Where(x => x.Code == request.BusinessPlaceCode)
|
||||
.Select(x => x.TenantId)
|
||||
.FirstAsync();
|
||||
|
||||
var payTypes = new List<BalanceRecordSourceEnumDto>();
|
||||
var dto1 = new BalanceRecordSourceEnumDto
|
||||
if (gainfo.Factory == selectTenantId)
|
||||
{
|
||||
Type = BalanceRecordSourceEnumType.Cash
|
||||
};
|
||||
payTypes.Add(dto1);
|
||||
|
||||
if (shift != null)
|
||||
{
|
||||
var businessShiftMealRelationships = await _dbContext.Queryable<BusinessShiftMealRelationshipEntity>()
|
||||
.Where(x => x.ShiftCode == shift.ShiftCode)
|
||||
.Select<BusinessShiftMealRelationshipResponse>()
|
||||
.ToListAsync();
|
||||
res.BusinessShiftMealRelationships = businessShiftMealRelationships;
|
||||
|
||||
if (shift.TenantId == request.Factory)
|
||||
{
|
||||
var dto2 = new BalanceRecordSourceEnumDto
|
||||
{
|
||||
Type = BalanceRecordSourceEnumType.LocalTenantSubsidies
|
||||
};
|
||||
payTypes.Add(dto2);
|
||||
payTypes.Add(new BalanceRecordSourceEnumDto { Type = BalanceRecordSourceEnumType.LocalTenantSubsidies });
|
||||
}
|
||||
|
||||
}
|
||||
res.PayTypes = payTypes;
|
||||
return res;
|
||||
return new DishesMenusBookingSettingResponse
|
||||
{
|
||||
ServerTime = DateTime.Now,
|
||||
Deadline = DateTime.Today.Add(deadline.ToTimeSpan()),
|
||||
PayTypes = payTypes
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<DishesDetailResponse> GetDishesDetailByIdAsync(long id)
|
||||
@@ -117,5 +113,17 @@ public class DishesService : IDishesService
|
||||
.Select<DishesDetailResponse>()
|
||||
.SingleAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取我的营业点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task<List<Guid>> GetMyBusinessPlaceCodesAsync()
|
||||
{
|
||||
return (await _businessPlacePermissionsService.GetMyAsync()).Select(x => x.Code).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.7.1" />
|
||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.7.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -27,6 +27,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="MealUser\Request\" />
|
||||
<Folder Include="Summary\Request\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Basic.MealUser.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
@@ -28,19 +27,8 @@ public class MealUsersController : ControllerBase
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<MealUserResponse>> GetPageAsync([FromQuery] MealUserPageRequest request)
|
||||
public async Task<Pagination<MealUserResponse>> GetPageAsync([FromQuery] PageDto request)
|
||||
{
|
||||
return await _mealUserService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 就餐人员保存
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task AddAsync(MealUserAddRequest request)
|
||||
{
|
||||
await _mealUserService.AddAsync(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Request;
|
||||
|
||||
public class MealUserAddRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 档案号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "档案号不能为空")]
|
||||
public string UserNo { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 用户类型
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(CanteenUserEnumType))]
|
||||
public CanteenUserEnumType UserType { get; set; }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Request;
|
||||
|
||||
public class MealUserPageRequest : PageDto
|
||||
{
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Response;
|
||||
namespace Dlhis.Basic.MealUser.Response;
|
||||
|
||||
public class MealUserResponse
|
||||
{
|
||||
@@ -15,13 +13,6 @@ public class MealUserResponse
|
||||
/// </summary>
|
||||
public string UserCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 消费人员类型
|
||||
/// </summary>
|
||||
public CanteenUserEnumType UserType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 卡号
|
||||
/// </summary>
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Services;
|
||||
|
||||
public interface IMealUserService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<MealUserResponse>> GetPageAsync(MealUserPageRequest request);
|
||||
|
||||
Task AddAsync(MealUserAddRequest request);
|
||||
Task<Pagination<MealUserResponse>> GetPageAsync(PageDto request);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
@@ -13,17 +9,15 @@ namespace Dlhis.Basic.MealUser.Services.Implements;
|
||||
public class MealUserService : IMealUserService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly IGainfoStore _gainfoStore;
|
||||
|
||||
public MealUserService(IDbContext dbContext, IGainfoStore gainfoStore)
|
||||
public MealUserService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_gainfoStore = gainfoStore;
|
||||
}
|
||||
|
||||
public async Task<Pagination<MealUserResponse>> GetPageAsync(MealUserPageRequest request)
|
||||
public async Task<Pagination<MealUserResponse>> GetPageAsync(PageDto request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<CanteenUserEntity>()
|
||||
var page = await _dbContext.Queryable<GainfoMealEntity>()
|
||||
.LeftJoin<GainfoEntity>((x, ga) => x.UserNo == ga.No)
|
||||
.Select((x, ga) => new MealUserResponse
|
||||
{
|
||||
@@ -32,32 +26,9 @@ public class MealUserService : IMealUserService
|
||||
BalanceOfSubsidies = x.BalanceOfSubsidies,
|
||||
UserCode = ga.Code,
|
||||
UserNo = ga.No,
|
||||
UserType = x.UserType
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
public async Task AddAsync(MealUserAddRequest request)
|
||||
{
|
||||
//todo 获取档案信息
|
||||
|
||||
var gainfoEntity = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
||||
.Where(x => x.No.ToString() == request.UserNo)
|
||||
.FirstAsync();
|
||||
|
||||
gainfoEntity.ThrowIfNull($"档案[{request.UserNo}]不存在");
|
||||
|
||||
var entity = new CanteenUserEntity
|
||||
{
|
||||
UserNo = request.UserNo,
|
||||
UserType = request.UserType,
|
||||
Balance = 0,
|
||||
BalanceOfRecharge = 0,
|
||||
BalanceOfSubsidies = 0,
|
||||
Version = 0,
|
||||
};
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -45,39 +46,6 @@ public class GainfosController : ControllerBase
|
||||
return await _gainfoService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 档案表修改
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("update")]
|
||||
public async Task UpdateAsync(GainfoSaveRequest request)
|
||||
{
|
||||
await _gainfoService.UpdateAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 离职
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("dimission")]
|
||||
public async Task DimissionAsync(GainfoDimissionRequest request)
|
||||
{
|
||||
await _gainfoService.DimissionAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入职
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("onboarding")]
|
||||
public async Task OnboardingAsync(GainfoDimissionRequest request)
|
||||
{
|
||||
await _gainfoService.OnboardingAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前人员信息,余额
|
||||
/// </summary>
|
||||
@@ -93,6 +61,7 @@ public class GainfosController : ControllerBase
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("face")]
|
||||
[Transactional]
|
||||
public async Task UploadFaceAsync(GainfoUploadFaceRequest request)
|
||||
{
|
||||
await _gainfoService.UploadFaceAsync(request);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using SqlSugar;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Response;
|
||||
|
||||
@@ -122,17 +120,11 @@ public class GainfoDetailResponse
|
||||
/// </summary>
|
||||
public string NationName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 人脸base64
|
||||
/// </summary>
|
||||
public string Face { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在职状态
|
||||
/// </summary>
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 厂区
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Converters;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Response;
|
||||
|
||||
@@ -45,6 +47,7 @@ public class GainfoPageResponse
|
||||
/// <summary>
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ObfuscateJsonConverter), 6)]
|
||||
public string IdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -86,6 +89,7 @@ public class GainfoPageResponse
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ObfuscateJsonConverter), 4)]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -13,7 +13,6 @@ using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
@@ -28,7 +27,6 @@ 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,
|
||||
@@ -48,7 +46,6 @@ public class GainfoService : IGainfoService
|
||||
_serviceProvider = serviceProvider;
|
||||
_configuration = configuration;
|
||||
_logger = logger;
|
||||
_departmentService = departmentService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -172,7 +169,7 @@ public class GainfoService : IGainfoService
|
||||
|
||||
var info = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
||||
.LeftJoin<DepartmentEntity>((ga, department) => ga.DepartmentNo == department.No)
|
||||
.LeftJoin<CanteenUserEntity>((ga, department, mealUser) => ga.No == mealUser.UserNo)
|
||||
.LeftJoin<GainfoMealEntity>((ga, department, mealUser) => ga.No == mealUser.UserNo)
|
||||
.Where((ga, department) => ga.Id == gainfo.Id)
|
||||
.Select((ga, department, mealUser) => new GainfoCurrentResponse
|
||||
{
|
||||
@@ -427,13 +424,6 @@ public class GainfoService : IGainfoService
|
||||
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)
|
||||
{
|
||||
@@ -446,201 +436,6 @@ public class GainfoService : IGainfoService
|
||||
return info;
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, Pagination<GainfoDetailResponse>>> GetWeekNumberAsync(WeekNumberRequest request, string token)
|
||||
{
|
||||
var werks = GetClaimValueFromToken(token, "tenant");
|
||||
|
||||
//获取近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 && ga.Werks == werks)
|
||||
.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,
|
||||
}).ToPageListAsync(request);
|
||||
|
||||
dic[time] = infos;
|
||||
}
|
||||
return dic;
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, Pagination<GainfoDetailResponse>>> GetDimissionWeekNumberAsync(WeekNumberRequest request, string token)
|
||||
{
|
||||
var werks = GetClaimValueFromToken(token, "tenant");
|
||||
|
||||
//获取近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 && ga.Werks == werks)
|
||||
.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,
|
||||
}).ToPageListAsync(request);
|
||||
dic[time] = infos;
|
||||
}
|
||||
return dic;
|
||||
}
|
||||
|
||||
public async Task<GainfoGainfoNumbersResponse> GetGainfoNumbersAsync(string token)
|
||||
{
|
||||
var werks = GetClaimValueFromToken(token, "tenant");
|
||||
|
||||
//在职人数
|
||||
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>
|
||||
/// 递归获取部门No
|
||||
/// </summary>
|
||||
/// <param name="departmentNos"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<List<string>> GetRecursionDepartmentNosAsync(List<string> departmentNos)
|
||||
{
|
||||
if (departmentNos.IsEmpty())
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
var departments = await _dbContext.Queryable<DepartmentEntity>().ToListAsync();
|
||||
var currentNos = departments.Where(x => departmentNos.Contains(x.No)).ToList();
|
||||
|
||||
foreach (var item in currentNos)
|
||||
{
|
||||
RecursionGetNext(item.No, departments, departmentNos);
|
||||
}
|
||||
|
||||
return departmentNos.Distinct().ToList();
|
||||
|
||||
void RecursionGetNext(string currentCode, List<DepartmentEntity> departments, List<string> result)
|
||||
{
|
||||
var next = departments.Where(x => x.PNo == currentCode).ToList();
|
||||
|
||||
foreach (var item in next)
|
||||
{
|
||||
result.Add(item.No);
|
||||
RecursionGetNext(item.No, departments, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解析token
|
||||
/// </summary>
|
||||
/// <param name="token"></param>
|
||||
/// <param name="claimType"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
private string GetClaimValueFromToken(string token, string claimType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var handler = new JwtSecurityTokenHandler();
|
||||
var jsonToken = handler.ReadToken(token) as JwtSecurityToken;
|
||||
|
||||
if (jsonToken == null)
|
||||
throw new Exception("Invalid JWT Token");
|
||||
|
||||
var claimValue = jsonToken.Claims.FirstOrDefault(c => c.Type == claimType)?.Value;
|
||||
|
||||
return claimValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task MigrationAsync(MigrationRequest request)
|
||||
{
|
||||
//档案数据
|
||||
@@ -677,4 +472,41 @@ public class GainfoService : IGainfoService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------help methods ------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// 递归获取部门No
|
||||
/// </summary>
|
||||
/// <param name="departmentNos"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<List<string>> GetRecursionDepartmentNosAsync(List<string> departmentNos)
|
||||
{
|
||||
if (departmentNos.IsEmpty())
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
var departments = await _dbContext.Queryable<DepartmentEntity>().ToListAsync();
|
||||
var currentNos = departments.Where(x => departmentNos.Contains(x.No)).ToList();
|
||||
|
||||
foreach (var item in currentNos)
|
||||
{
|
||||
RecursionGetNext(item.No, departments, departmentNos);
|
||||
}
|
||||
|
||||
return departmentNos.Distinct().ToList();
|
||||
|
||||
void RecursionGetNext(string currentCode, List<DepartmentEntity> departments, List<string> result)
|
||||
{
|
||||
var next = departments.Where(x => x.PNo == currentCode).ToList();
|
||||
|
||||
foreach (var item in next)
|
||||
{
|
||||
result.Add(item.No);
|
||||
RecursionGetNext(item.No, departments, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Dlhis.Basic.Places.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
|
||||
namespace Dlhis.Basic.Places.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 订餐地址
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class BookingAddressController : ControllerBase
|
||||
{
|
||||
private readonly IBookingAddressService _bookingAddresService;
|
||||
|
||||
public BookingAddressController(IBookingAddressService bookingAddresService)
|
||||
{
|
||||
_bookingAddresService = bookingAddresService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 地址分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<BookingAddressPageResponse>> GetAddresPageAsync([FromQuery] BookingAddressPageRequest request)
|
||||
{
|
||||
return await _bookingAddresService.GetAddressPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 所有地址
|
||||
/// </summary>
|
||||
/// <param name="tenant"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("all")]
|
||||
[IgnoreTenant]
|
||||
public async Task<List<BookingAddressPageResponse>> GetAllAddressAsync([Required(ErrorMessage = "厂区不可为空")] string tenant)
|
||||
{
|
||||
return await _bookingAddresService.GetAllAddressAsync(tenant);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 地址保存
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("save")]
|
||||
public async Task SaveAddresAsync(BookingAddressSaveRequest request)
|
||||
{
|
||||
await _bookingAddresService.SaveAddressAsync(request);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessPlace.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Dlhis.Basic.Places.Dtos;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 营业点管理
|
||||
/// 营业点权限管理
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
@@ -27,7 +28,7 @@ public class BusinessPlacePermissionsController
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize(Roles = "admin,tenant-admin")]
|
||||
[Authorize(Roles = "admin,tenant-admin,businessplace-manager")]
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<BusinessPlacePermissionPageResponse>> GetPageAsync([FromQuery] BusinessPlacePermissionPageRequest request)
|
||||
{
|
||||
@@ -39,7 +40,7 @@ public class BusinessPlacePermissionsController
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("my")]
|
||||
public async Task<GetMyResponse> GetMy()
|
||||
public async Task<List<BusinessPlaceDto>> GetMy()
|
||||
{
|
||||
return await _businessPlacePermissionsService.GetMyAsync();
|
||||
}
|
||||
@@ -52,8 +53,32 @@ public class BusinessPlacePermissionsController
|
||||
/// <returns></returns>
|
||||
[Authorize(Roles = "admin,tenant-admin")]
|
||||
[HttpPost("save")]
|
||||
public async Task SaveBusinessPlacePermissionAsync(SaveBusinessPlacePermissionRequest request)
|
||||
public async Task SaveBusinessPlacePermissionAsync(BusinessPlacePermissionSaveRequest request)
|
||||
{
|
||||
await _businessPlacePermissionsService.SaveBusinessPlacePermissionAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过userid获取分配的营业点信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize(Roles = "admin,tenant-admin")]
|
||||
[HttpGet("assignments/{userId}")]
|
||||
public async Task<List<BusinessPlacePermissionPageResponse>> GetBusinessPlacePermissionByUserIdAsyc(int userId)
|
||||
{
|
||||
return await _businessPlacePermissionsService.GetBusinessPlacePermissionByUserIdAsyc(userId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除记录
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize(Roles = "admin,tenant-admin")]
|
||||
[HttpDelete("{id}")]
|
||||
public async Task DeleteAssignmentAsync(int id)
|
||||
{
|
||||
await _businessPlacePermissionsService.DeleteAssignmentAsync(id);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessPlace.Services;
|
||||
using Dlhis.Basic.BusinessShift.Services;
|
||||
@@ -48,11 +48,23 @@ public class BusinessPlacesController : ControllerBase
|
||||
return await _businessPlaceService.GetOpenedListAsync(placeCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取启用的营业点(所有基地)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list-all")]
|
||||
[IgnoreTenant]
|
||||
public async Task<List<BusinessPlaceListResponse>> GetAllList(string tenant)
|
||||
{
|
||||
return await _businessPlaceService.GetOpenedListAsync(null, tenant);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 营业点保存
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize(Roles = "admin,tenant-admin")]
|
||||
[HttpPost("save")]
|
||||
public async Task SaveAsync(BusinessPlaceSaveRequest request)
|
||||
{
|
||||
7
Src/Dlhis.Basic/Places/Dtos/BusinessPlaceDto.cs
Normal file
7
Src/Dlhis.Basic/Places/Dtos/BusinessPlaceDto.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Dlhis.Basic.Places.Dtos;
|
||||
|
||||
public class BusinessPlaceDto
|
||||
{
|
||||
public Guid Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Places.Request;
|
||||
|
||||
public class BookingAddressPageRequest : PageDto
|
||||
{
|
||||
|
||||
}
|
||||
11
Src/Dlhis.Basic/Places/Request/BookingAddressSaveRequest.cs
Normal file
11
Src/Dlhis.Basic/Places/Request/BookingAddressSaveRequest.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Dlhis.Basic.Places.Request;
|
||||
|
||||
public class BookingAddressSaveRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订餐地址
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Request
|
||||
namespace Dlhis.Basic.Places.Request
|
||||
{
|
||||
public class BusinessPlaceGetByCodeRequest : PageDto
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Request;
|
||||
namespace Dlhis.Basic.Places.Request;
|
||||
|
||||
public class BusinessPlaceGetShiftsRequest
|
||||
{
|
||||
@@ -2,7 +2,7 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Request;
|
||||
namespace Dlhis.Basic.Places.Request;
|
||||
|
||||
public class BusinessPlacePageRequest : PageDto
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Request;
|
||||
namespace Dlhis.Basic.Places.Request;
|
||||
|
||||
public class BusinessPlacePermissionPageRequest : PageDto
|
||||
{
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Dlhis.Basic.Places.Request;
|
||||
|
||||
public class BusinessPlacePermissionSaveRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理人员userId
|
||||
/// </summary>
|
||||
public int UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
public List<Guid> BusinessPlaceCodes { get; set; } = new();
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Request;
|
||||
namespace Dlhis.Basic.Places.Request;
|
||||
|
||||
/// <summary>
|
||||
/// 营业点保存参数
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.Basic.BusinessPlace.Request;
|
||||
namespace Dlhis.Basic.Places.Request;
|
||||
|
||||
public class BusinessPlaceSaveShiftRequest
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.Basic.BusinessPlace.Request
|
||||
namespace Dlhis.Basic.Places.Request
|
||||
{
|
||||
public class DispositionDeviceRequest
|
||||
{
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Dlhis.Basic.Places.Response;
|
||||
|
||||
public class BookingAddressPageResponse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订餐地址
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
}
|
||||
@@ -7,7 +7,7 @@ public class BusinessPlacePermissionPageResponse
|
||||
/// <summary>
|
||||
/// 用户id
|
||||
/// </summary>
|
||||
public string UserId { get; set; }
|
||||
public int UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户name
|
||||
14
Src/Dlhis.Basic/Places/Services/IBookingAddressService.cs
Normal file
14
Src/Dlhis.Basic/Places/Services/IBookingAddressService.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Places.Services;
|
||||
|
||||
public interface IBookingAddressService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<BookingAddressPageResponse>> GetAddressPageAsync(BookingAddressPageRequest request);
|
||||
|
||||
Task<List<BookingAddressPageResponse>> GetAllAddressAsync(string tenant);
|
||||
|
||||
Task SaveAddressAsync(BookingAddressSaveRequest request);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Dlhis.Basic.Places.Dtos;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Services;
|
||||
|
||||
public interface IBusinessPlacePermissionsService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<BusinessPlacePermissionPageResponse>> GetPageAsync(BusinessPlacePermissionPageRequest request);
|
||||
|
||||
Task SaveBusinessPlacePermissionAsync(BusinessPlacePermissionSaveRequest request);
|
||||
|
||||
Task<List<BusinessPlaceDto>> GetMyAsync();
|
||||
|
||||
Task<List<BusinessPlacePermissionPageResponse>> GetBusinessPlacePermissionByUserIdAsyc(int id);
|
||||
|
||||
Task DeleteAssignmentAsync(int id);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
@@ -17,7 +17,7 @@ public interface IBusinessPlaceService : IScopeDependency
|
||||
/// 获取可用的营业点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<BusinessPlaceListResponse>> GetOpenedListAsync(Guid? placeCode);
|
||||
Task<List<BusinessPlaceListResponse>> GetOpenedListAsync(Guid? placeCode = null, string tenant = null);
|
||||
|
||||
/// <summary>
|
||||
/// 保存营业点
|
||||
@@ -0,0 +1,53 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.Places.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;
|
||||
|
||||
namespace Dlhis.Basic.Places.Services.Implements;
|
||||
|
||||
public class BookingAddressService : IBookingAddressService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public BookingAddressService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<Pagination<BookingAddressPageResponse>> GetAddressPageAsync(BookingAddressPageRequest request)
|
||||
{
|
||||
return await _dbContext.Queryable<BookingAddressEntity>()
|
||||
.WhereIF(request.Search.IsPresent(), x => x.Address.Contains(request.Search))
|
||||
.Select<BookingAddressPageResponse>()
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
public async Task SaveAddressAsync(BookingAddressSaveRequest request)
|
||||
{
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<BookingAddressEntity>();
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _dbContext.Queryable<BookingAddressEntity>()
|
||||
.Where(x => x.Id == request.Id)
|
||||
.FirstAsync();
|
||||
request.Adapt(entity);
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<BookingAddressPageResponse>> GetAllAddressAsync(string tenant)
|
||||
{
|
||||
return await _dbContext.Queryable<BookingAddressEntity>()
|
||||
.Where(x => x.TenantId == tenant)
|
||||
.Select<BookingAddressPageResponse>()
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using Dlhis.Basic.Places.Dtos;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Dlhis.Sys.Api;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Services.Implements;
|
||||
|
||||
public class BusinessPlacePermissionsService : IBusinessPlacePermissionsService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly ICurrentUser _currentUser;
|
||||
private readonly IUserApi _userApi;
|
||||
|
||||
public BusinessPlacePermissionsService(IDbContext dbContext, ICurrentUser currentUser, IUserApi userApi)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_currentUser = currentUser;
|
||||
_userApi = userApi;
|
||||
}
|
||||
|
||||
public async Task<Pagination<BusinessPlacePermissionPageResponse>> GetPageAsync(BusinessPlacePermissionPageRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<BusinessPlaceManagerRelationshipEntity>()
|
||||
.LeftJoin<BusinessPlaceEntity>((x, bplace) => x.BusinessPlaceCode == bplace.Code)
|
||||
.Select((x, bplace) => new BusinessPlacePermissionPageResponse
|
||||
{
|
||||
UserId = x.ManagerUserId,
|
||||
BusinessPlaceCode = x.BusinessPlaceCode,
|
||||
BusinessPlaceName = bplace.Name,
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
|
||||
var usersResult = await _userApi.GetUserByIdsAsync(page.Data.Select(x => x.UserId).Distinct().ToList());
|
||||
var users = usersResult.Data;
|
||||
|
||||
page.Data.ForEach(item =>
|
||||
{
|
||||
item.UserName = users.FirstOrDefault(x => x.Id == item.UserId)?.UserName;
|
||||
});
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
public async Task<List<BusinessPlaceDto>> GetMyAsync()
|
||||
{
|
||||
var userId = _currentUser.GetIntSubjectId();
|
||||
var role = _currentUser.GetUserClaim(ClaimTypes.Role);
|
||||
var isAdmin = role == "admin" || role == "tenant-admin";
|
||||
|
||||
var codes = new List<Guid>();
|
||||
if (isAdmin)
|
||||
{
|
||||
codes = await _dbContext.Queryable<BusinessPlaceEntity>()
|
||||
.Select(x => x.Code)
|
||||
.ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
codes = await _dbContext.Queryable<BusinessPlaceManagerRelationshipEntity>()
|
||||
.Where(x => x.ManagerUserId == userId)
|
||||
.Select(x => x.BusinessPlaceCode)
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
return await _dbContext.Queryable<BusinessPlaceEntity>()
|
||||
.Where(x => codes.Contains(x.Code))
|
||||
.Select<BusinessPlaceDto>()
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task SaveBusinessPlacePermissionAsync(BusinessPlacePermissionSaveRequest request)
|
||||
{
|
||||
var userId = _currentUser.GetIntSubjectId();
|
||||
|
||||
await _dbContext.Client.Deleteable<BusinessPlaceManagerRelationshipEntity>()
|
||||
.Where(x => x.ManagerUserId == request.UserId)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
await _dbContext.InsertAsync(request.BusinessPlaceCodes.Select(x => new BusinessPlaceManagerRelationshipEntity
|
||||
{
|
||||
BusinessPlaceCode = x,
|
||||
ManagerUserId = request.UserId
|
||||
}).ToList());
|
||||
}
|
||||
|
||||
public async Task<List<BusinessPlacePermissionPageResponse>> GetBusinessPlacePermissionByUserIdAsyc(int id)
|
||||
{
|
||||
var infos = await _dbContext.Queryable<BusinessPlaceManagerRelationshipEntity>()
|
||||
.LeftJoin<BusinessPlaceEntity>((x, bplace) => x.BusinessPlaceCode == bplace.Code)
|
||||
.Where(x => x.ManagerUserId == id)
|
||||
.Select((x, bplace) => new BusinessPlacePermissionPageResponse
|
||||
{
|
||||
UserId = x.ManagerUserId,
|
||||
BusinessPlaceCode = x.BusinessPlaceCode,
|
||||
BusinessPlaceName = bplace.Name,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var userResult = await _userApi.GetUserByIdAsync(id);
|
||||
var user = userResult.Data;
|
||||
|
||||
infos.ForEach(item =>
|
||||
{
|
||||
item.UserName = user?.UserName;
|
||||
});
|
||||
|
||||
return infos;
|
||||
}
|
||||
|
||||
public async Task DeleteAssignmentAsync(int id)
|
||||
{
|
||||
await _dbContext.Client.Deleteable<BusinessPlaceManagerRelationshipEntity>().Where(x => x.Id == id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
@@ -13,15 +13,18 @@ namespace Dlhis.Basic.BusinessPlace.Services.Implements;
|
||||
public class BusinessPlaceService : IBusinessPlaceService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly IBusinessPlacePermissionsService _businessPlacePermissionsService;
|
||||
|
||||
public BusinessPlaceService(IDbContext dbContext)
|
||||
public BusinessPlaceService(IDbContext dbContext, IBusinessPlacePermissionsService businessPlacePermissionsService)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_businessPlacePermissionsService = businessPlacePermissionsService;
|
||||
}
|
||||
|
||||
|
||||
public async Task<Pagination<BusinessPlaceResponse>> GetPageAsync(BusinessPlacePageRequest request)
|
||||
{
|
||||
var myCodes = await GetMyBusinessPlaceCodesAsync();
|
||||
|
||||
var page = await _dbContext.Queryable<BusinessPlaceEntity>()
|
||||
.LeftJoin<BusinessPlaceShiftRelationshipEntity>((x, ps) => x.Code == ps.PlaceCode)
|
||||
.LeftJoin<BusinessShiftEntity>((x, ps, s) => s.Code == ps.ShiftCode)
|
||||
@@ -30,6 +33,7 @@ public class BusinessPlaceService : IBusinessPlaceService
|
||||
.WhereIF(request.Catalog.HasValue, x => x.Catalog == request.Catalog)
|
||||
.WhereIF(request.Status.HasValue, x => x.Status == request.Status)
|
||||
.WhereIF(request.Source.HasValue, x => x.Source == request.Source)
|
||||
.Where(x => myCodes.Contains(x.Code))
|
||||
.Select((x, ps, s) => new BusinessPlaceResponse
|
||||
{
|
||||
Id = x.Id,
|
||||
@@ -49,13 +53,17 @@ public class BusinessPlaceService : IBusinessPlaceService
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<BusinessPlaceListResponse>> GetOpenedListAsync(Guid? placeCode)
|
||||
public async Task<List<BusinessPlaceListResponse>> GetOpenedListAsync(Guid? placeCode = null, string tenant = null)
|
||||
{
|
||||
var myCodes = await GetMyBusinessPlaceCodesAsync();
|
||||
|
||||
var list = await _dbContext.Queryable<BusinessPlaceEntity>()
|
||||
.LeftJoin<BusinessPlaceShiftRelationshipEntity>((x, ps) => x.Code == ps.PlaceCode)
|
||||
.LeftJoin<BusinessShiftEntity>((x, ps, s) => s.Code == ps.ShiftCode)
|
||||
.Where(x => x.Status == CanteenBusinessPlaceStatusEnumType.Opened)
|
||||
.WhereIF(placeCode.HasValue, x => x.Code == placeCode)
|
||||
.WhereIF(tenant.IsPresent(), x => x.TenantId == tenant)
|
||||
.Where(x => myCodes.Contains(x.Code))
|
||||
.Select((x, ps, s) => new BusinessPlaceListResponse
|
||||
{
|
||||
Id = x.Id,
|
||||
@@ -150,4 +158,13 @@ public class BusinessPlaceService : IBusinessPlaceService
|
||||
|
||||
existsSameCustomCode.ThrowIfTrue($"自定义手工号[{request.CustomCode}]存在重复,请检查.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取我的营业点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task<List<Guid>> GetMyBusinessPlaceCodesAsync()
|
||||
{
|
||||
return (await _businessPlacePermissionsService.GetMyAsync()).Select(x => x.Code).ToList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using Dlhis.Canteen.MealSupplementRecord.Request;
|
||||
using Dlhis.Canteen.MealSupplementRecord.Response;
|
||||
using Dlhis.Canteen.MealSupplementRecord.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Canteen.MealSupplementRecord.Controller;
|
||||
|
||||
/// <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("page")]
|
||||
public async Task<Pagination<MealSupplementRecordResponse>> MealSupplementRecordPageAsync([FromQuery] MealSupplementRecordRequest request)
|
||||
{
|
||||
return await _mealSupplementRecordService.GetPageAsync(request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Canteen.MealSupplementRecord.Request;
|
||||
|
||||
public class MealSupplementRecordRequest : PageDto
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using SqlSugar.DbConvert;
|
||||
using SqlSugar;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Canteen.MealSupplementRecord.Response;
|
||||
|
||||
public class MealSupplementRecordResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 唯一号
|
||||
/// </summary>
|
||||
public string UniqueId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工号
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐补状态
|
||||
/// </summary>
|
||||
public MealSupplementStatusEnumtype Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐补状态
|
||||
/// </summary>
|
||||
public string StatusDesc => 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; }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using Dlhis.Canteen.MealSupplementRecord.Request;
|
||||
using Dlhis.Canteen.MealSupplementRecord.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Canteen.MealSupplementRecord.Services;
|
||||
|
||||
public interface IMealSupplementRecordService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<MealSupplementRecordResponse>> GetPageAsync(MealSupplementRecordRequest request);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using Dlhis.Canteen.MealSupplementRecord.Request;
|
||||
using Dlhis.Canteen.MealSupplementRecord.Response;
|
||||
using Dlhis.Canteen.MealSupplementRecord.Services;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.Canteen.MealSupplementRecord.Services.Implements;
|
||||
|
||||
public class MealSupplementRecordService : IMealSupplementRecordService
|
||||
{
|
||||
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public MealSupplementRecordService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<Pagination<MealSupplementRecordResponse>> GetPageAsync(MealSupplementRecordRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<MealSupplementRecordEntity>()
|
||||
.LeftJoin<GainfoEntity>((x, ga) => x.Code == ga.Code)
|
||||
.WhereIF(request.Search.IsPresent(), (x, ga) => x.Code == request.Search || ga.Name.Contains(request.Search))
|
||||
.Select((x, ga) => new MealSupplementRecordResponse
|
||||
{
|
||||
Amount = x.Amount,
|
||||
Code = x.Code,
|
||||
Date = x.Date,
|
||||
Factory = x.Factory,
|
||||
Remark = x.Remark,
|
||||
Result = x.Result,
|
||||
Status = x.Status,
|
||||
Sync = x.Sync,
|
||||
UniqueId = x.UniqueId,
|
||||
UserName = ga.Name,
|
||||
Workplace = x.Workplace,
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
}
|
||||
@@ -25,10 +25,11 @@ public class BalancesController : ControllerBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取记录分页
|
||||
/// 获取所有消费记录分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize(Roles = "admin,tenant-admin")]
|
||||
[DataPermission]
|
||||
[HttpGet]
|
||||
public async Task<Pagination<BalanceRecordResponse>> GetPageAsync([FromQuery] BalanceRecordPageRequest request)
|
||||
@@ -154,7 +155,7 @@ public class BalancesController : ControllerBase
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("spendingDetails")]
|
||||
public async Task<Pagination<SpendingDetailResponse>> GetSpendingDetailsAsync([FromQuery]SpendingDetailRequest request)
|
||||
public async Task<Pagination<SpendingDetailResponse>> GetSpendingDetailsAsync([FromQuery] SpendingDetailRequest request)
|
||||
{
|
||||
return await _balanceService.GetSpendingDetailsAsync(request);
|
||||
}
|
||||
@@ -181,27 +182,14 @@ public class BalancesController : ControllerBase
|
||||
return await _balanceService.GetConsumeDeviceAsync(request);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 电子餐券申请记录查询
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("oaemealvoucher")]
|
||||
public async Task<Pagination<OaEMealVoucherResponse>> GetOaEMealVoucherAsync([FromQuery] OaEMealVoucherRequest request)
|
||||
{
|
||||
return await _balanceService.GetOaEMealVoucherAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 电子餐券使用记录查询
|
||||
/// 查询餐补入账记录
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("oaemealvoucherdetail")]
|
||||
public async Task<Pagination<OaEMealVoucherDetailResponse>> GetOaEMealVoucherDetailAsync([FromQuery] OaEMealVoucherDetailRequest request)
|
||||
[HttpGet("balanceOfMealSupplementRecordByUser")]
|
||||
public async Task<Pagination<BalanceRecordByUserResponse>> BalanceRecordByUserAsync([FromQuery] BalanceRecordByUserRequest request)
|
||||
{
|
||||
return await _balanceService.GetOaEMealVoucherDetailAsync(request);
|
||||
return await _balanceService.GetBalanceOfMealSupplementRecordByUser(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,21 +18,12 @@ namespace Dlhis.Canteen.Dishes.Controllers;
|
||||
public class OrdersController : ControllerBase
|
||||
{
|
||||
private readonly IOrderService _orderService;
|
||||
private readonly IBookingOrderService _bookingOrderService;
|
||||
|
||||
public OrdersController(IOrderService orderService)
|
||||
public OrdersController(IOrderService orderService, IBookingOrderService bookingOrderService)
|
||||
{
|
||||
_orderService = orderService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 订单分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<OrderResponse>> GetPageAsync([FromQuery] OrderPageRequest request)
|
||||
{
|
||||
return await _orderService.GetPageAsync(request);
|
||||
_bookingOrderService = bookingOrderService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -59,25 +50,67 @@ public class OrdersController : ControllerBase
|
||||
return await _orderService.AddAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 订单聚合数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("aggregation")]
|
||||
[IgnoreTenant]
|
||||
public async Task<Pagination<OrderAggregationResponse>> GetOrdersAggregationAsync([FromQuery] PageDto page)
|
||||
{
|
||||
return await _orderService.GetOrdersAggregationAsync(page);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消订单
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("user-cancel")]
|
||||
[Transactional]
|
||||
[IgnoreTenant]
|
||||
public async Task CancelOrderAsync(OrderCancelRequest request)
|
||||
{
|
||||
await _bookingOrderService.UserCancelOrderAsync(request);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 取消订单
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("manager-cancel")]
|
||||
[Transactional]
|
||||
[IgnoreTenant]
|
||||
public async Task ManagerCancelOrderAsync(OrderCancelRequest request)
|
||||
{
|
||||
await _bookingOrderService.ManagerCancelOrderAsync(request);
|
||||
}
|
||||
|
||||
//************************************************************** 订餐功能 **********************************************************************************
|
||||
|
||||
/// <summary>
|
||||
/// 订餐
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[IgnoreTenant]
|
||||
[HttpPost("booking")]
|
||||
public async Task Booking(BookingMealRequest request)
|
||||
[Transactional]
|
||||
[IgnoreTenant]
|
||||
public async Task<BookingResponse> Booking(BookingMealRequest request)
|
||||
{
|
||||
await _orderService.Booking(request);
|
||||
return await _bookingOrderService.BookingAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 充值
|
||||
/// 订单分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("recharge")]
|
||||
public async Task ReCharge()
|
||||
[HttpGet("booking/page")]
|
||||
public async Task<Pagination<OrderBookingResponse>> GetBookingPageAsync([FromQuery] OrderBookingPageRequest request)
|
||||
{
|
||||
|
||||
return await _bookingOrderService.GetBookingPageAsync(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Request;
|
||||
|
||||
public class BalanceRecordByUserRequest : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户档案号
|
||||
/// </summary>
|
||||
public string UserNo { get; set; }
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using Kurisu.Core.CustomClass;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Canteen.Dishes.Request
|
||||
namespace Dlhis.Canteen.Order.Request
|
||||
{
|
||||
public class BalanceRecordUserPageRequest : PageDto, IValidatableObject
|
||||
{
|
||||
@@ -13,11 +13,17 @@ namespace Dlhis.Canteen.Dishes.Request
|
||||
[EnumDataType(typeof(DateTimeSearchEnumType))]
|
||||
public DateTimeSearchEnumType? SearchDateTimeDimension { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消费应用类型
|
||||
/// </summary>
|
||||
public CanteenApplicaitonTypeEnumType? ApplicationType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日期范围查询
|
||||
/// </summary>
|
||||
public DateTimePeriod SearchDateTimePeriod { get; set; }
|
||||
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
@@ -43,8 +49,8 @@ namespace Dlhis.Canteen.Dishes.Request
|
||||
}
|
||||
else if (SearchDateTimeDimension == DateTimeSearchEnumType.Season)
|
||||
{
|
||||
SearchDateTimePeriod.Start = now.AddMonths(0 - ((now.Month - 1) % 3));
|
||||
SearchDateTimePeriod.End = now.AddMonths(3 - ((now.Month - 1) % 3)).AddMonths(1).AddDays(-1);
|
||||
SearchDateTimePeriod.Start = now.AddMonths(0 - (now.Month - 1) % 3);
|
||||
SearchDateTimePeriod.End = now.AddMonths(3 - (now.Month - 1) % 3).AddMonths(1).AddDays(-1);
|
||||
}
|
||||
else if (SearchDateTimeDimension == DateTimeSearchEnumType.HalfOfYear)
|
||||
{
|
||||
|
||||
@@ -30,12 +30,28 @@ public class BookingMealRequest : IValidatableObject
|
||||
[Required(ErrorMessage = "选菜不能为空")]
|
||||
public string DishesCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 购买数量
|
||||
/// </summary>
|
||||
[Range(0, 100)]
|
||||
public int Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string Unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消费来源
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(BalanceRecordSourceEnumType))]
|
||||
public BalanceRecordSourceEnumType Source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配送地址
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string DeliveryAddress { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Canteen.Dishes.Request
|
||||
{
|
||||
public class OaEMealVoucherDetailRequest : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 餐券id
|
||||
/// </summary>
|
||||
public long OaEMealVoucherId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Canteen.Dishes.Request
|
||||
{
|
||||
public class OaEMealVoucherRequest : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户学工号
|
||||
/// </summary>
|
||||
public string UserCode { get; set; }
|
||||
}
|
||||
}
|
||||
14
Src/Dlhis.Canteen/Order/Request/OrderBookingPageRequest.cs
Normal file
14
Src/Dlhis.Canteen/Order/Request/OrderBookingPageRequest.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Request;
|
||||
|
||||
public class OrderBookingPageRequest : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单状态 CanteenOrderStatusEnumType
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(CanteenOrderStatusEnumType))]
|
||||
public CanteenOrderStatusEnumType? OrderStatus { get; set; }
|
||||
}
|
||||
18
Src/Dlhis.Canteen/Order/Request/OrderCancelRequest.cs
Normal file
18
Src/Dlhis.Canteen/Order/Request/OrderCancelRequest.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Request;
|
||||
|
||||
public class OrderCancelRequest
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "订单号")]
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 取消原因
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Reason { get; set; }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Request;
|
||||
|
||||
public class OrderPageRequest : PageDto
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using SqlSugar.DbConvert;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Request
|
||||
{
|
||||
public class SaveDetailRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单号
|
||||
/// </summary>
|
||||
public string ThirdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业日
|
||||
/// </summary>
|
||||
public DateOnly BusinessDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
public ShiftEnumType ShiftType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品编码
|
||||
/// </summary>
|
||||
public Guid DishesCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品名称
|
||||
/// </summary>
|
||||
public Guid DishesName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单价
|
||||
/// </summary>
|
||||
public decimal Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string Unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public int Num { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 金额
|
||||
/// </summary>
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单明细状态
|
||||
/// </summary>
|
||||
public OrderDetailsStatusEnumType OrderStatus { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace Dlhis.Canteen.Order.Response;
|
||||
|
||||
public class BalanceRecordByUserResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 流水号
|
||||
/// </summary>
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 金额
|
||||
/// </summary>
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消费时间
|
||||
/// </summary>
|
||||
public DateTime CostDateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
@@ -49,4 +49,15 @@ public class BalanceRecordUserResponse
|
||||
/// 记录产生日期
|
||||
/// </summary>
|
||||
public DateTime CostDateTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 消费应用类型
|
||||
/// </summary>
|
||||
public CanteenApplicaitonTypeEnumType ApplicationType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消费应用类型
|
||||
/// </summary>
|
||||
public string ApplicationTypeDesc => ApplicationType.GetDescription();
|
||||
}
|
||||
|
||||
32
Src/Dlhis.Canteen/Order/Response/BookingResponse.cs
Normal file
32
Src/Dlhis.Canteen/Order/Response/BookingResponse.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Response;
|
||||
|
||||
public class BookingResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单号
|
||||
/// </summary>
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消费金额
|
||||
/// </summary>
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 支付方式
|
||||
/// </summary>
|
||||
public BalanceRecordSourceEnumType Source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 支付方式
|
||||
/// </summary>
|
||||
public string SourceDesc => Source.GetDescription();
|
||||
}
|
||||
34
Src/Dlhis.Canteen/Order/Response/DishesDto.cs
Normal file
34
Src/Dlhis.Canteen/Order/Response/DishesDto.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Response;
|
||||
|
||||
public class DishesDto
|
||||
{
|
||||
[JsonIgnore]
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品编码
|
||||
/// </summary>
|
||||
public string DishesCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 购买单价
|
||||
/// </summary>
|
||||
public decimal Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 购买数量
|
||||
/// </summary>
|
||||
public int Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图片
|
||||
/// </summary>
|
||||
public string ImageUrl { get; set; }
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Response;
|
||||
|
||||
public class GetDetailResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单号
|
||||
/// </summary>
|
||||
public string ThirdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业日
|
||||
/// </summary>
|
||||
public DateOnly SysDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
public ShiftEnumType ShiftType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次CN
|
||||
/// </summary>
|
||||
public string ShiftTypeCN => ShiftType.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 菜品编码
|
||||
/// </summary>
|
||||
public Guid DishesCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜品名称
|
||||
/// </summary>
|
||||
public string DishesName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单价
|
||||
/// </summary>
|
||||
public decimal Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string Unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public int Num { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 金额
|
||||
/// </summary>
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单明细状态
|
||||
/// </summary>
|
||||
public OrderDetailsStatusEnumType OrderStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单明细状态CN
|
||||
/// </summary>
|
||||
public string OrderStatusCN => OrderStatus.GetDescription();
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Response
|
||||
{
|
||||
public class OaEMealVoucherDetailResponse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public long VoucherId { get; set; }
|
||||
|
||||
public int Sequence { get; set; }
|
||||
|
||||
public string DinnerType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证
|
||||
/// </summary>
|
||||
public string IdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用餐人
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 就餐开始
|
||||
/// </summary>
|
||||
public DateTime Start { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 就餐结束
|
||||
/// </summary>
|
||||
public DateTime End { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 就餐天数
|
||||
/// </summary>
|
||||
public int Days { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 金额
|
||||
/// </summary>
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 二维码
|
||||
/// </summary>
|
||||
public string QrCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 信息
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
namespace Dlhis.Canteen.Order.Response;
|
||||
|
||||
public class OaEMealVoucherResponse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 申请人工号
|
||||
/// </summary>
|
||||
public string UserCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 申请人名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 基地代码
|
||||
/// </summary>
|
||||
public string TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 基地名称
|
||||
/// </summary>
|
||||
public string TenantName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 成本中心
|
||||
/// </summary>
|
||||
public string CostId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 成本中心名称
|
||||
/// </summary>
|
||||
public string CostName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来宾公司
|
||||
/// </summary>
|
||||
public string Company { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 联系人
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来宾人数
|
||||
/// </summary>
|
||||
public int Num { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 就餐食堂
|
||||
/// </summary>
|
||||
public string Canteen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 就餐事由
|
||||
/// </summary>
|
||||
public string Reason { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 就餐次
|
||||
/// </summary>
|
||||
public string CanteenShift { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// oa流程id
|
||||
/// </summary>
|
||||
public string OaId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门号
|
||||
/// </summary>
|
||||
public string DepartmentNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
public string DepartmentName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 申请日期
|
||||
/// </summary>
|
||||
public DateTime LogDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
67
Src/Dlhis.Canteen/Order/Response/OrderAggregationResponse.cs
Normal file
67
Src/Dlhis.Canteen/Order/Response/OrderAggregationResponse.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Response;
|
||||
|
||||
public class OrderAggregationResponse
|
||||
{
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
public string BusinessPlaceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 购买菜品
|
||||
/// </summary>
|
||||
public List<DishesDto> Dishes { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 金额
|
||||
/// </summary>
|
||||
public decimal Amount
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Dishes.IsPresent())
|
||||
{
|
||||
return Dishes.Sum(x => x.Number * x.Price);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 共计数量
|
||||
/// </summary>
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Dishes.IsPresent())
|
||||
{
|
||||
return Dishes.Count;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 订单时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单状态
|
||||
/// </summary>
|
||||
public CanteenOrderStatusEnumType OrderStatus { get; set; }
|
||||
|
||||
|
||||
public string OrderStatusDesc => OrderStatus.GetDescription();
|
||||
}
|
||||
58
Src/Dlhis.Canteen/Order/Response/OrderBookingResponse.cs
Normal file
58
Src/Dlhis.Canteen/Order/Response/OrderBookingResponse.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Response;
|
||||
|
||||
public class OrderBookingResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单号
|
||||
/// </summary>
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配送地址
|
||||
/// </summary>
|
||||
public string DeliveryAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单金额
|
||||
/// </summary>
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工号
|
||||
/// </summary>
|
||||
public string UserCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
public ShiftEnumType? ShiftType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
public string ShiftTypeDesc => ShiftType.GetDescription();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 订单时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
|
||||
public CanteenOrderStatusEnumType Status { get; set; }
|
||||
|
||||
public string StatusDesc => Status.GetDescription();
|
||||
}
|
||||
34
Src/Dlhis.Canteen/Order/Response/OrderDetailResponse.cs
Normal file
34
Src/Dlhis.Canteen/Order/Response/OrderDetailResponse.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
//namespace Dlhis.Canteen.Order.Response;
|
||||
|
||||
//public class OrderDetailResponse
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// 菜品编码
|
||||
// /// </summary>
|
||||
// public string DishesCode { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 菜品名称
|
||||
// /// </summary>
|
||||
// public string Name { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 单价
|
||||
// /// </summary>
|
||||
// public decimal Price { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 数量
|
||||
// /// </summary>
|
||||
// public int Number { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 单位
|
||||
// /// </summary>
|
||||
// public string Unit { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 图片
|
||||
// /// </summary>
|
||||
// public string ImageUrl { get; set; }
|
||||
//}
|
||||
@@ -1,5 +0,0 @@
|
||||
namespace Dlhis.Canteen.Order.Response;
|
||||
|
||||
public class OrderResponse
|
||||
{
|
||||
}
|
||||
@@ -35,7 +35,5 @@ public interface IBalanceService : IScopeDependency
|
||||
Task<Pagination<DevicePageResponse>> GetConsumeDeviceAsync(GetConsumeDeviceRequest request);
|
||||
|
||||
|
||||
Task<Pagination<OaEMealVoucherResponse>> GetOaEMealVoucherAsync([FromQuery] OaEMealVoucherRequest request);
|
||||
|
||||
Task<Pagination<OaEMealVoucherDetailResponse>> GetOaEMealVoucherDetailAsync([FromQuery] OaEMealVoucherDetailRequest request);
|
||||
Task<Pagination<BalanceRecordByUserResponse>> GetBalanceOfMealSupplementRecordByUser(BalanceRecordByUserRequest request);
|
||||
}
|
||||
|
||||
23
Src/Dlhis.Canteen/Order/Services/IBookingOrderService.cs
Normal file
23
Src/Dlhis.Canteen/Order/Services/IBookingOrderService.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Dlhis.Canteen.Dishes.Request;
|
||||
using Dlhis.Canteen.Order.Request;
|
||||
using Dlhis.Canteen.Order.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Services;
|
||||
|
||||
public interface IBookingOrderService : IScopeDependency
|
||||
{
|
||||
/// <summary>
|
||||
/// 订餐
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
Task<BookingResponse> BookingAsync(BookingMealRequest request);
|
||||
|
||||
|
||||
Task<Pagination<OrderBookingResponse>> GetBookingPageAsync(OrderBookingPageRequest request);
|
||||
|
||||
Task UserCancelOrderAsync(OrderCancelRequest request);
|
||||
|
||||
Task ManagerCancelOrderAsync(OrderCancelRequest request);
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dlhis.Canteen.Dishes.Request;
|
||||
using Dlhis.Canteen.Order.Request;
|
||||
using Dlhis.Canteen.Order.Request;
|
||||
using Dlhis.Canteen.Order.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
@@ -7,7 +6,6 @@ namespace Dlhis.Canteen.Order.Services;
|
||||
|
||||
public interface IOrderService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<OrderResponse>> GetPageAsync(OrderPageRequest request);
|
||||
|
||||
Task<OrderResultResponse> AddAsync(OrderAddRequest request);
|
||||
|
||||
@@ -18,10 +16,5 @@ public interface IOrderService : IScopeDependency
|
||||
/// <returns></returns>
|
||||
Task<OrderResultResponse> DeviceConsume(OrderAddRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 订餐
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
Task Booking(BookingMealRequest request);
|
||||
Task<Pagination<OrderAggregationResponse>> GetOrdersAggregationAsync(PageDto page);
|
||||
}
|
||||
|
||||
@@ -521,13 +521,14 @@ public class BalanceService : IBalanceService
|
||||
.LeftJoin<GainfoEntity>((record, ga) => record.UserNo == ga.No)
|
||||
.LeftJoin<DepartmentEntity>((record, ga, department) => ga.DepartmentNo == department.No)
|
||||
.LeftJoin<BusinessPlaceEntity>((record, ga, department, bplace) => record.BusinessPlaceCode == bplace.Code)
|
||||
.LeftJoin<BusinessShiftEntity>((record, ga, department, bplace, bshift) => record.BusinessShiftCode == bshift.Code)
|
||||
.LeftJoin<BasicTypeEntity>((record, ga, department, bplace, bshift, type) => record.BusinessShiftCode.ToString() == type.Code)
|
||||
.LeftJoin<BusinessPlaceShiftRelationshipEntity>((record, ga, department, bplace, bshiftR) => bplace.Code == bshiftR.PlaceCode)
|
||||
.LeftJoin<BusinessShiftEntity>((record, ga, department, bplace, bshiftR, shift) => shift.Code == bshiftR.ShiftCode)
|
||||
.WhereIF(request.SearchDateTimePeriod?.Start.HasValue == true, record => record.CostDate >= request.SearchDateTimePeriod.Start)
|
||||
.WhereIF(request.SearchDateTimePeriod?.End.HasValue == true, record => record.CostDate <= request.SearchDateTimePeriod.End)
|
||||
.WhereIF(request.ApplicationType.HasValue, record => record.ApplicationType == request.ApplicationType)
|
||||
.Where((record, ga) => ga.IdentityUserId == userId)
|
||||
.OrderBy(record => record.CreateTime, OrderByType.Desc)
|
||||
.Select((record, ga, department, bplace, bshift, type) => new BalanceRecordUserResponse
|
||||
.Select((record, ga, department, bplace, bshiftR, shift) => new BalanceRecordUserResponse
|
||||
{
|
||||
Id = record.Id,
|
||||
Amount = record.Amount,
|
||||
@@ -536,8 +537,9 @@ public class BalanceService : IBalanceService
|
||||
Source = record.Source,
|
||||
No = record.No,
|
||||
BusinessPlaceName = bplace.Name,
|
||||
BusinessShiftName = type.Display,
|
||||
CostDateTime = record.CostDateTime
|
||||
BusinessShiftName = shift.Name,
|
||||
CostDateTime = record.CostDateTime,
|
||||
ApplicationType = record.ApplicationType,
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
|
||||
@@ -558,12 +560,12 @@ public class BalanceService : IBalanceService
|
||||
await ContinueUpdateAsync(async () =>
|
||||
{
|
||||
//重算金额
|
||||
var canteenUser = await _dbContext.Queryable<CanteenUserEntity>().Where(x => x.UserNo == balanceRecord.UserNo).SingleAsync();
|
||||
var canteenUser = await _dbContext.Queryable<GainfoMealEntity>().Where(x => x.UserNo == balanceRecord.UserNo).SingleAsync();
|
||||
|
||||
//金额 +
|
||||
canteenUser.Balance += Math.Abs(balanceRecord.Amount);
|
||||
|
||||
var effect = await _dbContext.Updateable<CanteenUserEntity>()
|
||||
var effect = await _dbContext.Updateable<GainfoMealEntity>()
|
||||
.SetColumns(x => x.Balance == canteenUser.Balance)
|
||||
.SetColumns(x => x.Version == x.Version + 1)
|
||||
.Where(x => x.UserNo == balanceRecord.UserNo && x.Version == canteenUser.Version)
|
||||
@@ -742,6 +744,25 @@ public class BalanceService : IBalanceService
|
||||
return page;
|
||||
}
|
||||
|
||||
public async Task<Pagination<BalanceRecordByUserResponse>> GetBalanceOfMealSupplementRecordByUser(BalanceRecordByUserRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<BalanceRecordEntity>()
|
||||
.Where(x => x.Source == BalanceRecordSourceEnumType.LocalTenantSubsidies || x.Source == BalanceRecordSourceEnumType.OtherTenantSubsidies)
|
||||
.Where(x => x.UserNo == request.UserNo)
|
||||
.Select<BalanceRecordByUserResponse>()
|
||||
.ToPageListAsync(request);
|
||||
|
||||
page.Data.Add(new BalanceRecordByUserResponse
|
||||
{
|
||||
Amount = 20,
|
||||
CostDateTime = DateTime.Now.Date,
|
||||
Remark = "2024-03-21 餐补",
|
||||
No = "129876578"
|
||||
});
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取离线设备
|
||||
@@ -839,26 +860,6 @@ public class BalanceService : IBalanceService
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public async Task<Pagination<OaEMealVoucherResponse>> GetOaEMealVoucherAsync(OaEMealVoucherRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<OaEMealVoucherEntity>()
|
||||
.Where(x => x.UserCode == request.UserCode)
|
||||
.Select<OaEMealVoucherResponse>()
|
||||
.ToPageListAsync(request);
|
||||
return page;
|
||||
}
|
||||
|
||||
public async Task<Pagination<OaEMealVoucherDetailResponse>> GetOaEMealVoucherDetailAsync(OaEMealVoucherDetailRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<OaEMealVoucherDetailEntity>()
|
||||
.Where(x => x.VoucherId == request.OaEMealVoucherId)
|
||||
.Select<OaEMealVoucherDetailResponse>()
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前年所有月
|
||||
/// </summary>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user