feat 营业点增加配置设备接口
This commit is contained in:
@@ -4,6 +4,7 @@ using Dlhis.Canteen.Order.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Controllers;
|
||||
|
||||
@@ -158,6 +159,17 @@ public class BalancesController : ControllerBase
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 营业点增加配置设备接口
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("disposition")]
|
||||
public async Task DispositionDeviceAsync([FromQuery]DispositionDeviceRequest request)
|
||||
{
|
||||
await _balanceService.DispositionDeviceAsync(request);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 电子餐券申请记录查询
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Dlhis.Canteen.Order.Request
|
||||
{
|
||||
public class DispositionDeviceRequest
|
||||
{
|
||||
public string PlaceCode { get; set; }
|
||||
|
||||
public List<string> UniqueNos { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,8 @@ public interface IBalanceService : IScopeDependency
|
||||
|
||||
Task<Pagination<DevicePageResponse>> GetConsumeDeviceAsync(GetConsumeDeviceRequest request);
|
||||
|
||||
Task DispositionDeviceAsync(DispositionDeviceRequest request);
|
||||
|
||||
|
||||
Task<Pagination<OaEMealVoucherResponse>> GetOaEMealVoucherAsync([FromQuery] OaEMealVoucherRequest request);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ using Kurisu.Core.DataAccess.Entity;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Services.Implements;
|
||||
@@ -735,6 +736,33 @@ public class BalanceService : IBalanceService
|
||||
}
|
||||
|
||||
|
||||
public async Task DispositionDeviceAsync(DispositionDeviceRequest request)
|
||||
{
|
||||
var places = await _dbContext.Queryable<BusinessPlaceEntity>().ToListAsync();
|
||||
var place = places.Where(x => x.Code.ToString() == request.PlaceCode).First();
|
||||
place.ThrowIfNull($"{request.PlaceCode}:该营业点不存在");
|
||||
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().ToListAsync();
|
||||
foreach (var no in request.UniqueNos)
|
||||
{
|
||||
var device = devices.Where(x => x.UniqueNo == no).First();
|
||||
device.ThrowIfNull("设备不存在");
|
||||
}
|
||||
var regiss = await _dbContext.Queryable<DeviceRegistryEntity>()
|
||||
.Where(x => request.UniqueNos.Contains(x.DeviceUniqueNo))
|
||||
.ToListAsync();
|
||||
|
||||
var list = new List<DeviceRegistryEntity>();
|
||||
|
||||
foreach (var regis in regiss)
|
||||
{
|
||||
regis.BusinessPlaceCode = place.Code;
|
||||
regis.BusinessPlaceCustomCode = place.CustomCode;
|
||||
list.Add(regis);
|
||||
}
|
||||
await _dbContext.UpdateAsync(list);
|
||||
}
|
||||
|
||||
public async Task<Pagination<OaEMealVoucherResponse>> GetOaEMealVoucherAsync(OaEMealVoucherRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<OaEMealVoucherEntity>()
|
||||
|
||||
Reference in New Issue
Block a user