133 lines
4.1 KiB
C#
133 lines
4.1 KiB
C#
using Dlhis.Basic.BusinessShift.Services;
|
|
using Dlhis.Basic.Device.Filters;
|
|
using Dlhis.Basic.Places.Request;
|
|
using Dlhis.Basic.Places.Response;
|
|
using Dlhis.Basic.Places.Services;
|
|
using Kurisu.AspNetCore.DataAccess.Dto;
|
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Dlhis.Basic.Places.Controllers;
|
|
|
|
/// <summary>
|
|
/// 营业点
|
|
/// </summary>
|
|
[Authorize]
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class BusinessPlacesController : ControllerBase
|
|
{
|
|
private readonly IBusinessPlaceService _businessPlaceService;
|
|
private readonly IBusinessPlaceShiftService _businessPlaceShiftService;
|
|
|
|
public BusinessPlacesController(IBusinessPlaceService businessPlaceService,
|
|
IBusinessPlaceShiftService businessPlaceShiftService)
|
|
{
|
|
_businessPlaceService = businessPlaceService;
|
|
_businessPlaceShiftService = businessPlaceShiftService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 营业点分页
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("page")]
|
|
public async Task<Pagination<BusinessPlaceResponse>> GetPageAsync([FromQuery] BusinessPlacePageRequest request)
|
|
{
|
|
return await _businessPlaceService.GetPageAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取启用的营业点
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("list")]
|
|
public async Task<List<BusinessPlaceListResponse>> GetOpenedListAsync(Guid? placeCode)
|
|
{
|
|
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)
|
|
{
|
|
await _businessPlaceService.SaveAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 营业点保存餐次
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("shift/save")]
|
|
public async Task SaveShiftAsync(BusinessPlaceSaveShiftRequest request)
|
|
{
|
|
await _businessPlaceService.SaveShiftAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据手工号获取餐别
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("shifts")]
|
|
[IgnoreTenant]
|
|
public async Task<BusinessPlaceWithShiftResponse> GetShiftsByPlaceCustomCodeHttpPostAsync(BusinessPlaceGetShiftsRequest request)
|
|
{
|
|
return await _businessPlaceShiftService.GetShiftsByPlaceCustomCodeAsync(request.CustomCode);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据手工号获取餐别
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("shifts")]
|
|
[IgnoreTenant]
|
|
public async Task<BusinessPlaceWithShiftResponse> GetShiftsByPlaceCustomCodeHttpGetAsync([FromQuery] BusinessPlaceGetShiftsRequest request)
|
|
{
|
|
return await _businessPlaceShiftService.GetShiftsByPlaceCustomCodeAsync(request.CustomCode);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据营业点获取下面的设备
|
|
/// </summary>
|
|
/// <param name="code"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("device/assignments")]
|
|
public async Task<List<DeviceCodeNameDetail>> GetAssignments(Guid code)
|
|
{
|
|
return await _businessPlaceShiftService.GetAssignmentsAsync(code);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 营业点增加配置设备
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpPost("device/assign")]
|
|
[AssignPermissionLimit]
|
|
[DataPermission]
|
|
public async Task Assign(DispositionDeviceRequest request)
|
|
{
|
|
await _businessPlaceShiftService.AssignAsync(request);
|
|
}
|
|
} |