Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development
This commit is contained in:
@@ -29,6 +29,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Canteen", "Src\Dlhis.
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Sys.Api", "Src\Dlhis.Sys.Api\Dlhis.Sys.Api.csproj", "{85A345C7-913E-4C1B-BE1C-600DE408A02F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dlhis.Basic.Api", "Src\Dlhis.Basic.Api\Dlhis.Basic.Api.csproj", "{1F337648-8A22-4601-A842-0F634FBA2825}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -71,6 +73,10 @@ Global
|
||||
{85A345C7-913E-4C1B-BE1C-600DE408A02F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{85A345C7-913E-4C1B-BE1C-600DE408A02F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{85A345C7-913E-4C1B-BE1C-600DE408A02F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1F337648-8A22-4601-A842-0F634FBA2825}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1F337648-8A22-4601-A842-0F634FBA2825}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1F337648-8A22-4601-A842-0F634FBA2825}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1F337648-8A22-4601-A842-0F634FBA2825}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -84,6 +90,7 @@ Global
|
||||
{925048C9-5940-4B51-8480-4DC908C754A1} = {57074FD8-1A2F-40C7-8476-001778A3F65D}
|
||||
{8317C526-3523-4195-9B19-2F17CFD71927} = {3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}
|
||||
{85A345C7-913E-4C1B-BE1C-600DE408A02F} = {57074FD8-1A2F-40C7-8476-001778A3F65D}
|
||||
{1F337648-8A22-4601-A842-0F634FBA2825} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {7439494A-E2FD-4FEA-8ABF-74AE57A4A5A0}
|
||||
|
||||
13
Src/Dlhis.Basic.Api/Dlhis.Basic.Api.csproj
Normal file
13
Src/Dlhis.Basic.Api/Dlhis.Basic.Api.csproj
Normal file
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Kurisu.RemoteCall" Version="0.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
11
Src/Dlhis.Basic.Api/IDevicePermissionApi.cs
Normal file
11
Src/Dlhis.Basic.Api/IDevicePermissionApi.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Kurisu.Core.Result;
|
||||
using Kurisu.RemoteCall.Attributes;
|
||||
|
||||
namespace Dlhis.Basic.Api;
|
||||
|
||||
[EnableRemoteClient(Name = "basic-service", BaseUrl = "${InternalRequest:BasicRequestUrl}")]
|
||||
public interface IDevicePermissionApi
|
||||
{
|
||||
[Get("/api/devicepermissions/canteen/uniqueNos")]
|
||||
Task<DefaultApiResult<List<string>>> GetCanteenDeviceUniqueNosByUserNoAsync(string userNo);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using Dlhis.Basic.Device.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
|
||||
namespace Dlhis.Basic.Device.Controllers;
|
||||
|
||||
@@ -51,4 +52,16 @@ public class DevicePermissionsController : ControllerBase
|
||||
{
|
||||
return await _devicePermissionService.GetAssigmentByCodeAsync(request);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 就餐设备唯一号权限
|
||||
/// </summary>
|
||||
/// <param name="userNo"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("canteen/uniqueNos")]
|
||||
public async Task<List<string>> GetCanteenDeviceUniqueNosByUserNoAsync(string userNo)
|
||||
{
|
||||
return await _devicePermissionService.GetCanteenDeviceUniqueNosByUserNoAsync(userNo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ namespace Dlhis.Basic.Device.Response;
|
||||
|
||||
public class DeviceGroupTreeResponse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上级分组code
|
||||
/// </summary>
|
||||
|
||||
@@ -50,6 +50,14 @@ public interface IDevicePermissionService : IScopeDependency
|
||||
/// <returns></returns>
|
||||
Task<List<Guid>> GetAssignDeviceCodesAsync(string userNo);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取就餐权限唯一号
|
||||
/// </summary>
|
||||
/// <param name="userNo"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<string>> GetCanteenDeviceUniqueNosByUserNoAsync(string userNo);
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户权限设备
|
||||
/// </summary>
|
||||
|
||||
@@ -198,6 +198,17 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<string>> GetCanteenDeviceUniqueNosByUserNoAsync(string userNo)
|
||||
{
|
||||
var all = await GetAssignDeviceCodesAsync(userNo);
|
||||
|
||||
return await _dbContext.Queryable<DeviceEntity>().Where(x => x.Type == DeviceTypeEnumType.Meal)
|
||||
.Where(x => all.Contains(x.Code))
|
||||
.Select(x => x.UniqueNo)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户所有设备权限
|
||||
/// </summary>
|
||||
@@ -340,7 +351,7 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().ToListAsync();
|
||||
|
||||
if(ggs != null && ggs.Count > 0)
|
||||
if (ggs != null && ggs.Count > 0)
|
||||
{
|
||||
foreach (var gid in ggs)
|
||||
{
|
||||
@@ -351,7 +362,7 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
gds.AddRange(ds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var dds = gds.Distinct().ToList();
|
||||
var lst = devices.Where(x => dds.Contains(x.Code))
|
||||
.Select(x => new AssigmentByCodeResponse
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dlhis.Basic.Api\Dlhis.Basic.Api.csproj" />
|
||||
<ProjectReference Include="..\Dlhis.Common.Api\Dlhis.Common.Api.csproj" />
|
||||
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||
</ItemGroup>
|
||||
@@ -36,6 +37,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.5.2" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -7,6 +7,7 @@ EXPOSE 80
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["Src/Dlhis.Canteen/Dlhis.Canteen.csproj", "Src/Dlhis.Canteen/"]
|
||||
COPY ["Src/Dlhis.Basic.Api/Dlhis.Basic.Api.csproj", "Src/Dlhis.Basic.Api/"]
|
||||
COPY ["Src/Dlhis.Common.Api/Dlhis.Common.Api.csproj", "Src/Dlhis.Common.Api/"]
|
||||
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
||||
RUN dotnet restore "Src/Dlhis.Canteen/Dlhis.Canteen.csproj"
|
||||
|
||||
@@ -43,5 +43,4 @@ public class OrdersController : ControllerBase
|
||||
{
|
||||
return await _orderService.AddAsync(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using Dlhis.Canteen.Order.Request;
|
||||
using Dlhis.Basic.Api;
|
||||
using Dlhis.Canteen.Order.Request;
|
||||
using Dlhis.Canteen.Order.Response;
|
||||
using Dlhis.Canteen.Setting.Services;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
@@ -22,14 +24,17 @@ public class OrderService : IOrderService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly ICanteenSettingService _canteenSettingService;
|
||||
private readonly IDevicePermissionApi _devicePermissionApi;
|
||||
private readonly ILogger<OrderService> _logger;
|
||||
|
||||
public OrderService(IDbContext dbContext,
|
||||
ICanteenSettingService canteenSettingService,
|
||||
IDevicePermissionApi devicePermissionApi,
|
||||
ILogger<OrderService> logger)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_canteenSettingService = canteenSettingService;
|
||||
_devicePermissionApi = devicePermissionApi;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -42,6 +47,14 @@ public class OrderService : IOrderService
|
||||
return page;
|
||||
}
|
||||
|
||||
private async Task CheckPAsync(string userNo, string deviceUniqueNo)
|
||||
{
|
||||
var uniqueNosResult = await _devicePermissionApi.GetCanteenDeviceUniqueNosByUserNoAsync(userNo);
|
||||
var uniqueNos = uniqueNosResult.Data;
|
||||
|
||||
uniqueNos.Contains(deviceUniqueNo).ThrowIfFalse("无消费权限");
|
||||
}
|
||||
|
||||
[IgnoreTenant]
|
||||
public async Task<OrderResultResponse> AddAsync(OrderAddRequest request)
|
||||
{
|
||||
@@ -59,7 +72,8 @@ public class OrderService : IOrderService
|
||||
.AnyAsync();
|
||||
canteenUserExists.ThrowIfFalse($"就餐用户{request.UserUniqueNo}不存在,无法操作");
|
||||
|
||||
|
||||
//消费权限控制
|
||||
await CheckPAsync(gainfo.No, request.DeviceUniqueNo);
|
||||
|
||||
//消费
|
||||
if (request.Type == BalanceRecordTypeEnumType.Out)
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
}
|
||||
},
|
||||
"InternalRequest": {
|
||||
"CommonRequestUrl": "http://localhost:5001"
|
||||
"CommonRequestUrl": "http://localhost:5001",
|
||||
"BasicRequestUrl": "http://localhost:5002"
|
||||
},
|
||||
"SwaggerOptions": {
|
||||
"Enable": true,
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"InternalRequest": {
|
||||
"CommonRequestUrl": "http://common"
|
||||
"CommonRequestUrl": "http://common",
|
||||
"BasicRequestUrl": "http://basic"
|
||||
},
|
||||
"SqlSugarOptions": {
|
||||
"DefaultConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=yikatong;charset=utf8mb4;",
|
||||
|
||||
25
Src/Dlhis.Entity/Basic/Entity/BusinessPlaceGroupEntity.cs
Normal file
25
Src/Dlhis.Entity/Basic/Entity/BusinessPlaceGroupEntity.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Kurisu.Core.DataAccess.Entity;
|
||||
using Kurisu.SqlSugar;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Entity.Basic.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// 营业点分组
|
||||
/// </summary>
|
||||
[SugarTable(TableName = "BusinessPlaceGroup", TableDescription = "营业点分组")]
|
||||
public class BusinessPlaceGroupEntity : SugarBaseEntity, ITenantId
|
||||
{
|
||||
public Guid? PCode { get; set; }
|
||||
|
||||
public Guid Code { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
[SugarColumn(ColumnDescription = "备注")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Kurisu.Core.DataAccess.Entity;
|
||||
using Kurisu.SqlSugar;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Entity.Basic.Entity;
|
||||
|
||||
|
||||
[SugarTable(TableName = "BusinessPlaceGroupRelationship", TableDescription = "营业点分组")]
|
||||
public class BusinessPlaceGroupRelationshipEntity : SugarBaseEntity, ITenantId
|
||||
{
|
||||
public Guid BusinessPlaceGroupCode { get; set; }
|
||||
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user