feat 外包人员,框架升级
This commit is contained in:
@@ -47,7 +47,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Message", "Message", "{65E7
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Message", "Src\Dlhis.Message\Dlhis.Message.csproj", "{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dlhis.InfoCheck", "Src\Dlhis.InfoCheck\Dlhis.InfoCheck.csproj", "{4D656761-8CE7-4316-A3DF-8C1722D69CCE}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.InfoCheck", "Src\Dlhis.InfoCheck\Dlhis.InfoCheck.csproj", "{4D656761-8CE7-4316-A3DF-8C1722D69CCE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Kurisu.RemoteCall" Version="0.0.3" />
|
||||
<PackageReference Include="Kurisu.RemoteCall" Version="0.4.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
7
Src/Dlhis.Basic.Api/Dto/BusinessPlaceDto.cs
Normal file
7
Src/Dlhis.Basic.Api/Dto/BusinessPlaceDto.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Dlhis.Basic.Api.Dto;
|
||||
|
||||
public class BusinessPlaceDto
|
||||
{
|
||||
public Guid Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.Basic.Api.Dtos;
|
||||
namespace Dlhis.Basic.Api.Dto;
|
||||
|
||||
public class DishesMenuDetailDto
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.Basic.Api.Dtos;
|
||||
namespace Dlhis.Basic.Api.Dto;
|
||||
|
||||
public class PermissionUsersInfoDto
|
||||
{
|
||||
@@ -11,4 +11,4 @@ public class PermissionUsersInfoDto
|
||||
/// 用户对应的 [ 厂区--设备Code ]
|
||||
/// </summary>
|
||||
public Dictionary<string, List<UserTenantDeviceCodeDto>> PermissionInfos { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.Basic.Api.Dtos;
|
||||
namespace Dlhis.Basic.Api.Dto;
|
||||
|
||||
public class UserTenantDeviceCodeDto
|
||||
{
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dlhis.Basic.Api.Dtos
|
||||
{
|
||||
public class BusinessPlaceDto
|
||||
{
|
||||
public Guid Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using Dlhis.Basic.Api.Dtos;
|
||||
using Dlhis.Basic.Api.Dto;
|
||||
using Dlhis.Basic.Api.Request;
|
||||
using Kurisu.Core.Result;
|
||||
using Kurisu.RemoteCall.Attributes;
|
||||
using Kurisu.RemoteCall.Default;
|
||||
|
||||
namespace Dlhis.Basic.Api;
|
||||
|
||||
@@ -14,4 +14,4 @@ public interface IBusinessPlacePermissionsApi
|
||||
|
||||
[Post("/api/gainfoPermissions/reset")]
|
||||
Task<DefaultApiResult> ResetAsync(GainfoPermissionResetRequest request);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Basic.Api.Response;
|
||||
using Kurisu.Core.Result;
|
||||
using Kurisu.RemoteCall.Attributes;
|
||||
using Kurisu.RemoteCall.Default;
|
||||
|
||||
namespace Dlhis.Basic.Api;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Basic.Api.Dtos;
|
||||
using Kurisu.Core.Result;
|
||||
using Dlhis.Basic.Api.Dto;
|
||||
using Kurisu.RemoteCall.Attributes;
|
||||
using Kurisu.RemoteCall.Default;
|
||||
|
||||
namespace Dlhis.Basic.Api;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Basic.Api.Dtos;
|
||||
using Kurisu.Core.Result;
|
||||
using Dlhis.Basic.Api.Dto;
|
||||
using Kurisu.RemoteCall.Attributes;
|
||||
using Kurisu.RemoteCall.Default;
|
||||
|
||||
namespace Dlhis.Basic.Api;
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Dlhis.Basic.Api.Request
|
||||
{
|
||||
public class SaveBusinessPlacePermissionRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
using Dlhis.Basic.BusinessShift.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.BusinessShift.Request;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.Core.CustomClass;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
|
||||
namespace Dlhis.Basic.BusinessShift.Request;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.BusinessShift.Services;
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Sys.Api;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.CustomClass;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.Result;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.BusinessShift.Services.Implements;
|
||||
@@ -29,7 +28,7 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
|
||||
public async Task<Pagination<BusinessPlaceShiftResponse>> GetPageAsync(BusinessPlaceShiftPageRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<BusinessShiftEntity>()
|
||||
.WhereIF(request.Search.IsPresent(), (shift) => shift.CustomCode.Contains(request.Search) || shift.Name.Contains(request.Search))
|
||||
.WhereIF(request.Search.IsPresent(), shift => shift.CustomCode.Contains(request.Search) || shift.Name.Contains(request.Search))
|
||||
.Select<BusinessPlaceShiftResponse>()
|
||||
.ToPageListAsync(request);
|
||||
|
||||
@@ -133,8 +132,7 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
|
||||
}
|
||||
|
||||
var tenantResult = await _tenantApi.GetTenantByCodeAsync(place.TenantId);
|
||||
(tenantResult.Code == ApiStateCode.Success).ThrowIfFalse(tenantResult.Msg);
|
||||
var tenantInfo = tenantResult.Data;
|
||||
var tenantInfo = tenantResult.EnsureSuccessStatusCode();
|
||||
|
||||
var relationship = await _dbContext.Queryable<BusinessPlaceShiftRelationshipEntity>().Where(x => x.PlaceCode == place.Code).FirstAsync();
|
||||
if (relationship == null)
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using Kurisu.Core.CustomClass;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
|
||||
namespace Dlhis.Basic.BusinessShift;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 临时的扩展类 todo: 嵌入框架
|
||||
/// </summary>
|
||||
@@ -38,4 +37,4 @@ public static class TimePeriodExtensions
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
using Dlhis.Basic.Device.Dtos;
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -186,7 +186,7 @@ public class DevicesController : ControllerBase
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("attendancesoffline")]
|
||||
public async Task<Pagination<DevicePageResponse>> GetAttendanceOfflineAsync([FromQuery] DeviceOnlineAndofflineRequest request)
|
||||
public async Task<Pagination<DevicePageResponse>> GetAttendanceOfflineAsync([FromQuery] DeviceOnlineAndOfflineRequest request)
|
||||
{
|
||||
return await _deviceService.GetAttendanceOfflineAsync(request);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Request
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Request
|
||||
{
|
||||
public class DeviceOnlineAndofflineRequest : PageDto
|
||||
public class DeviceOnlineAndOfflineRequest : PageDto
|
||||
{
|
||||
public bool IsOnAndOff { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Request;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Request;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Response
|
||||
{
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using Dlhis.Basic.Device.Dtos;
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services;
|
||||
|
||||
@@ -21,7 +20,7 @@ public interface IDeviceService : IScopeDependency
|
||||
|
||||
Task<Pagination<DevicePageResponse>> GetAttendanceTotalAsync(AttendanceTotalRequest request);
|
||||
|
||||
Task<Pagination<DevicePageResponse>> GetAttendanceOfflineAsync(DeviceOnlineAndofflineRequest request);
|
||||
Task<Pagination<DevicePageResponse>> GetAttendanceOfflineAsync(DeviceOnlineAndOfflineRequest request);
|
||||
|
||||
Task<Pagination<DevicePageResponse>> GetDoorOfflineAsync(GetDoorOfflineRequest request);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services;
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.CustomClass;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services.Implements;
|
||||
|
||||
@@ -3,9 +3,9 @@ using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services.Implements;
|
||||
|
||||
@@ -5,10 +5,10 @@ using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.DataAccess.Entity;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Entity;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services.Implements;
|
||||
|
||||
@@ -7,13 +7,13 @@ using Dlhis.Entity.Canteen.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Sys.Api;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Entity;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.CustomClass;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.DataAccess.Entity;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -419,7 +419,7 @@ public class DeviceService : IDeviceService
|
||||
return page;
|
||||
}
|
||||
|
||||
public async Task<Pagination<DevicePageResponse>> GetAttendanceOfflineAsync(DeviceOnlineAndofflineRequest request)
|
||||
public async Task<Pagination<DevicePageResponse>> GetAttendanceOfflineAsync(DeviceOnlineAndOfflineRequest request)
|
||||
{
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => x.Type == DeviceTypeEnumType.Attendance || (x.Type == DeviceTypeEnumType.Door && x.AsAttendance)).ToListAsync();
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.CustomClass;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -3,8 +3,8 @@ using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.Dishes.Response;
|
||||
using Dlhis.Basic.Dishes.Services;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class DishesMenusController : ControllerBase
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<DishesMenuPageResponse>> GetDishesMenuPageAsync([FromQuery] DisheMenuPageRequest request)
|
||||
public async Task<Pagination<DishesMenuPageResponse>> GetDishesMenuPageAsync([FromQuery] DishesMenuPageRequest request)
|
||||
{
|
||||
return await _dishesMenuService.GetDishesMenuPageAsync(request);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.CustomClass;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Request;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Request;
|
||||
|
||||
public class DisheMenuPageRequest : PageDto
|
||||
public class DishesMenuPageRequest : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 营业点code
|
||||
@@ -1,4 +1,4 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Request;
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.Dishes.Dto;
|
||||
using Dlhis.Basic.Dishes.Response;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Services;
|
||||
|
||||
public interface IDishesMenuService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<DishesMenuPageResponse>> GetDishesMenuPageAsync(DisheMenuPageRequest request);
|
||||
Task<Pagination<DishesMenuPageResponse>> GetDishesMenuPageAsync(DishesMenuPageRequest request);
|
||||
|
||||
Task<DishesMenuSaveRequest> GetDishesMenuDetailAsync(Guid businessPlaceCode, string customCode, DateTime startDate, DateTime endDate);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.Dishes.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Services;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Dlhis.Basic.BusinessPlace.Services;
|
||||
using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.Dishes.Response;
|
||||
using Dlhis.Basic.Places.Services;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Services.Implements;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using SqlSugar;
|
||||
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;
|
||||
using Dlhis.Basic.Places.Services;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Services.Implements;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class DishesMenuService : IDishesMenuService
|
||||
_businessPlacePermissionsService = businessPlacePermissionsService;
|
||||
}
|
||||
|
||||
public async Task<Pagination<DishesMenuPageResponse>> GetDishesMenuPageAsync(DisheMenuPageRequest request)
|
||||
public async Task<Pagination<DishesMenuPageResponse>> GetDishesMenuPageAsync(DishesMenuPageRequest request)
|
||||
{
|
||||
return await _dbContext.Queryable<DishesMenuEntity>()
|
||||
.Where(x => x.BusinessPlaceCode == request.BusinessPlaceCode)
|
||||
@@ -43,11 +43,11 @@ public class DishesMenuService : IDishesMenuService
|
||||
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();
|
||||
.Where(x => x.BusinessPlaceCode == businessPlaceCode)
|
||||
.Where(x => x.CustomCode == customCode)
|
||||
.Where(x => x.StartDate == startDate)
|
||||
.Where(x => x.EndDate == endDate)
|
||||
.ToListAsync();
|
||||
|
||||
if (data.IsEmpty())
|
||||
{
|
||||
@@ -71,7 +71,7 @@ public class DishesMenuService : IDishesMenuService
|
||||
Start = data[0].StartDate,
|
||||
End = data[0].EndDate,
|
||||
},
|
||||
ShiftTypes = data.GroupBy(x => x.ShiftType).Select(item =>
|
||||
ShiftTypes = data.GroupBy(x => x.ShiftType).Select(item =>
|
||||
{
|
||||
var shiftType = item.Key;
|
||||
|
||||
@@ -85,7 +85,6 @@ public class DishesMenuService : IDishesMenuService
|
||||
Price = x.Price,
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
}).ToList()
|
||||
}
|
||||
}
|
||||
@@ -168,10 +167,10 @@ public class DishesMenuService : IDishesMenuService
|
||||
keys.ForEach(x =>
|
||||
{
|
||||
deleteWhere = deleteWhere.Or(item => item.BusinessPlaceCode == request.BusinessPlaceCode
|
||||
&& item.CustomCode == x.CustomCode
|
||||
//&& SqlFunc.DateIsSame(item.StartDate, x.StartDate, DateType.Day)
|
||||
//&& SqlFunc.DateIsSame(item.EndDate, x.EndDate, DateType.Day)
|
||||
&& item.ShiftType == x.ShiftType);
|
||||
&& item.CustomCode == x.CustomCode
|
||||
//&& 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(deleteWhere).ExecuteCommandAsync();
|
||||
@@ -182,7 +181,7 @@ public class DishesMenuService : IDishesMenuService
|
||||
request.Items.ForEach(p =>
|
||||
{
|
||||
whereCheck = whereCheck.Or(x => x.BusinessPlaceCode == request.BusinessPlaceCode
|
||||
&& !(x.EndDate < p.Period.Start || x.StartDate > p.Period.End)
|
||||
&& !(x.EndDate < p.Period.Start || x.StartDate > p.Period.End)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -196,24 +195,24 @@ public class DishesMenuService : IDishesMenuService
|
||||
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.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 = date,
|
||||
MenuId = x.Id,
|
||||
DishesId = d.Id,
|
||||
DishesCode = d.CustomCode,
|
||||
DishesName = d.Name,
|
||||
Price = x.Price == null || x.Price == 0 ? d.Price : x.Price.Value,
|
||||
Number = x.Number,
|
||||
Version = x.Version,
|
||||
})
|
||||
.SingleAsync();
|
||||
.LeftJoin<DishesEntity>((x, d) => x.DishesCode == d.CustomCode)
|
||||
.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 = date,
|
||||
MenuId = x.Id,
|
||||
DishesId = d.Id,
|
||||
DishesCode = d.CustomCode,
|
||||
DishesName = d.Name,
|
||||
Price = x.Price == null || x.Price == 0 ? d.Price : x.Price.Value,
|
||||
Number = x.Number,
|
||||
Version = x.Version,
|
||||
})
|
||||
.SingleAsync();
|
||||
|
||||
return detail;
|
||||
}
|
||||
@@ -237,4 +236,4 @@ public class DishesMenuService : IDishesMenuService
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
using Dlhis.Basic.BusinessPlace.Services;
|
||||
using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.Dishes.Request;
|
||||
using Dlhis.Basic.Dishes.Response;
|
||||
using Dlhis.Basic.Places.Services;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
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;
|
||||
|
||||
namespace Dlhis.Basic.Dishes.Services.Implements;
|
||||
@@ -31,19 +31,18 @@ public class DishesService : IDishesService
|
||||
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,
|
||||
|
||||
}, true)
|
||||
.ToPageListAsync(request);
|
||||
.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,
|
||||
}, true)
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,13 +84,12 @@ public class DishesService : IDishesService
|
||||
deadline = new TimeOnly(8, 30);
|
||||
|
||||
|
||||
|
||||
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();
|
||||
.Where(x => x.Code == request.BusinessPlaceCode)
|
||||
.Select(x => x.TenantId)
|
||||
.FirstAsync();
|
||||
|
||||
if (gainfo.Factory == selectTenantId)
|
||||
{
|
||||
@@ -115,8 +113,6 @@ public class DishesService : IDishesService
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取我的营业点
|
||||
/// </summary>
|
||||
@@ -125,5 +121,4 @@ public class DishesService : IDishesService
|
||||
{
|
||||
return (await _businessPlacePermissionsService.GetMyAsync()).Select(x => x.Code).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,12 +20,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.8.5" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dlhis.Common.Api\Dlhis.Common.Api.csproj" />
|
||||
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||
<ProjectReference Include="..\Dlhis.Scheduled.Api\Dlhis.Scheduled.Api.csproj" />
|
||||
<ProjectReference Include="..\Dlhis.Sys.Api\Dlhis.Sys.Api.csproj" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Dlhis.Basic.Map.Request;
|
||||
using Dlhis.Basic.Map.Response;
|
||||
using Dlhis.Basic.Map.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Basic.Map.Request;
|
||||
using Dlhis.Basic.Map.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Map.Services;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Dlhis.Basic.Map.Request;
|
||||
using Dlhis.Basic.Map.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Map.Services.Implements;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Dlhis.Basic.Map.Request;
|
||||
using Dlhis.Basic.Map.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Map.Services.Implements;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Basic.MealUser.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Services;
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Microsoft.CodeAnalysis;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Services.Implements;
|
||||
|
||||
@@ -43,4 +42,4 @@ public class MealUserService : IMealUserService
|
||||
|
||||
return page;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 外包人员
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class GainfoOutSourceController : ControllerBase
|
||||
{
|
||||
private readonly IGainfoOutSourceService _gainfoOutSourceService;
|
||||
|
||||
public GainfoOutSourceController(IGainfoOutSourceService gainfoOutSourceService)
|
||||
{
|
||||
_gainfoOutSourceService = gainfoOutSourceService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入职
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
[HttpPost("entry")]
|
||||
public async Task EntryAsync(GainfoOutEntryRequest request)
|
||||
{
|
||||
await _gainfoOutSourceService.EntryAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 离职
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
[HttpPost("resign")]
|
||||
public async Task ResignAsync(GainfoOutResignRequest request)
|
||||
{
|
||||
await _gainfoOutSourceService.ResignAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
[HttpPost("edit")]
|
||||
public async Task EditAsync(GainfoOutEntryRequest request)
|
||||
{
|
||||
await _gainfoOutSourceService.EditAsync(request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 外包人员
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class GainfoOutsourceController : ControllerBase
|
||||
{
|
||||
private readonly IGainfoOutsourceService _gainfoOutSourceService;
|
||||
|
||||
public GainfoOutsourceController(IGainfoOutsourceService gainfoOutSourceService)
|
||||
{
|
||||
_gainfoOutSourceService = gainfoOutSourceService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入职
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
[HttpPost("entry")]
|
||||
[Transactional]
|
||||
public async Task EntryAsync(GainfoOutsourceRequest request)
|
||||
{
|
||||
await _gainfoOutSourceService.SaveAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
[HttpPost("edit")]
|
||||
[Transactional]
|
||||
public async Task EditAsync(GainfoOutsourceRequest request)
|
||||
{
|
||||
await _gainfoOutSourceService.SaveAsync(request);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -188,5 +188,16 @@ public class GainfosController : ControllerBase
|
||||
{
|
||||
return await _gainfoService.CheckIdNoAndNameMatchAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 离职
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
[HttpPost("resign")]
|
||||
[Transactional]
|
||||
public async Task ResignAsync(GainfoResignRequest request)
|
||||
{
|
||||
await _gainfoService.ResignAsync(request);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Dto;
|
||||
|
||||
/// <summary>
|
||||
/// 外包人员额外信息
|
||||
/// </summary>
|
||||
public class GainfoOutSourceExternalInfoDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 供应商
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "供应商不可为空")]
|
||||
public string Supplier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 对接人员工号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "对接人工号不可为空")]
|
||||
public string SapCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 对接人员手机号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "对接人手机号不可为空")]
|
||||
public string SapPhone { get; set; }
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using Kurisu.Core.Result;
|
||||
using Kurisu.Core.Result.Abstractions;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Newtonsoft.Json;
|
||||
@@ -43,4 +43,4 @@ public class IgnoreDataCaseAttribute : Attribute, IAsyncResultFilter
|
||||
//eg:过滤器直接响应结果,此处进行短路
|
||||
//await next();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using Kurisu.Core.Result;
|
||||
using Kurisu.Core.Result.Abstractions;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request;
|
||||
|
||||
|
||||
@@ -1,36 +1,35 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request
|
||||
namespace Dlhis.Basic.Organization.Request;
|
||||
|
||||
public class GainfoListRequest : PageDto
|
||||
{
|
||||
public class GainfoListRequest:PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 档案类型
|
||||
/// </summary>
|
||||
[Required]
|
||||
[EnumDataType(typeof(GainfoStatusEnumType))]
|
||||
public GainfoStatusEnumType Status { get; set; }
|
||||
/// <summary>
|
||||
/// 档案类型
|
||||
/// </summary>
|
||||
[Required]
|
||||
[EnumDataType(typeof(GainfoStatusEnumType))]
|
||||
public GainfoStatusEnumType Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
public string IdNo { get; set; }
|
||||
/// <summary>
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
public string IdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门编码
|
||||
/// </summary>
|
||||
public string DepartmentNo { get; set; }
|
||||
/// <summary>
|
||||
/// 部门编码
|
||||
/// </summary>
|
||||
public string DepartmentNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 学工号
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 学工号
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request;
|
||||
|
||||
public class GainfoOutEntryRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 证件类型代码
|
||||
/// </summary>
|
||||
public string IdClass { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
public string IdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证籍贯区域代码
|
||||
/// </summary>
|
||||
public string Native { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别 GenderEnumType
|
||||
/// </summary>
|
||||
public GenderEnumType Gender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生日
|
||||
/// </summary>
|
||||
public DateTime Birthday { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证地址
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门编码
|
||||
/// </summary>
|
||||
public string DepartmentNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 民族代码
|
||||
/// </summary>
|
||||
public string Nation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 学历
|
||||
/// </summary>
|
||||
public string Degree { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 岗位
|
||||
/// </summary>
|
||||
public string PositionNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 职等
|
||||
/// </summary>
|
||||
public string Grade { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 职级
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 卡号
|
||||
/// </summary>
|
||||
public string CardNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人事范围
|
||||
/// </summary>
|
||||
public string Werks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工作地
|
||||
/// </summary>
|
||||
public string Workplace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 厂区
|
||||
/// </summary>
|
||||
public string Factory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 成本中心
|
||||
/// </summary>
|
||||
public string CostId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入职日期
|
||||
/// </summary>
|
||||
public DateTime? EntryDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 离职日期
|
||||
/// </summary>
|
||||
public DateTime? ResignationDate { get; set; }
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request
|
||||
{
|
||||
public class GainfoOutResignRequest : IValidatableObject
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Reason { get; set; }
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (Date < DateTime.Now.Date)
|
||||
{
|
||||
yield return new ValidationResult("离职日期不能小于当前时间", new[] { nameof(Date) });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Basic.Organization.Dto;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request;
|
||||
|
||||
public class GainfoOutsourceRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "姓名不可为空")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 证件类型代码
|
||||
/// </summary>
|
||||
public string IdClass { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 证件号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "证件号不可为空")]
|
||||
public string IdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别 GenderEnumType
|
||||
/// </summary>
|
||||
public GenderEnumType Gender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生日
|
||||
/// </summary>
|
||||
public DateTime Birthday { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "手机号不可为空")]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 厂区
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "厂区不可为空")]
|
||||
public string Factory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入职日期
|
||||
/// </summary>
|
||||
public DateTime? EntryDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 离职日期
|
||||
/// </summary>
|
||||
public DateTime? ResignationDate { get; set; }
|
||||
|
||||
|
||||
public GainfoOutSourceExternalInfoDto ExternalInfo { get; set; }
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request;
|
||||
|
||||
@@ -16,13 +16,13 @@ public class GainfoPageRequest : PageDto, IValidatableObject
|
||||
/// <summary>
|
||||
/// 部门选择
|
||||
/// </summary>
|
||||
public List<TenantDepartmentRequest> DepartmentSelections { get; set; } = new List<TenantDepartmentRequest>();
|
||||
public List<TenantDepartmentRequest> DepartmentSelections { get; set; } = new();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否为外包
|
||||
/// </summary>
|
||||
public bool? IsOutSource { get; set; }
|
||||
public bool? IsOutsource { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
@@ -36,7 +36,6 @@ public class GainfoPageRequest : PageDto, IValidatableObject
|
||||
});
|
||||
|
||||
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Src/Dlhis.Basic/Organization/Request/GainfoResignRequest.cs
Normal file
31
Src/Dlhis.Basic/Organization/Request/GainfoResignRequest.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request;
|
||||
|
||||
public class GainfoResignRequest : IValidatableObject
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 离职原因
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "离职原因不能为空")]
|
||||
public string Reason { get; set; }
|
||||
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 是否外包
|
||||
/// </summary>
|
||||
public bool IsOutsource { get; set; } = true;
|
||||
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (Date < DateTime.Now.Date)
|
||||
{
|
||||
yield return new ValidationResult("离职日期不能小于当前时间", new[] { nameof(Date) });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request
|
||||
{
|
||||
public class WeekNumberRequest : PageDto
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
|
||||
public interface IGainfoOutSourceService : IScopeDependency
|
||||
{
|
||||
Task EntryAsync(GainfoOutEntryRequest request);
|
||||
|
||||
Task ResignAsync(GainfoOutResignRequest request);
|
||||
|
||||
Task EditAsync(GainfoOutEntryRequest request);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
|
||||
public interface IGainfoOutsourceService : IScopeDependency
|
||||
{
|
||||
Task SaveAsync(GainfoOutsourceRequest request);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
|
||||
@@ -19,4 +19,6 @@ public interface IGainfoService : IScopeDependency
|
||||
Task MigrationAsync(MigrationRequest request);
|
||||
|
||||
Task<string> CheckIdNoAndNameMatchAsync(GainfoCheckIdNoAndNameRequest request);
|
||||
|
||||
Task ResignAsync(GainfoResignRequest request);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Sys.Api;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.CustomClass;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.DataAccess.Entity;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Entity;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
@@ -1,37 +1,57 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
public class GainfoOutSourceService : IGainfoOutSourceService
|
||||
public class GainfoOutsourceService : IGainfoOutsourceService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly RedisCache _redisCache;
|
||||
|
||||
public GainfoOutSourceService(IDbContext dbContext, RedisCache redisCache)
|
||||
public GainfoOutsourceService(IDbContext dbContext, RedisCache redisCache )
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_redisCache = redisCache;
|
||||
}
|
||||
|
||||
public async Task EntryAsync(GainfoOutEntryRequest request)
|
||||
public async Task SaveAsync(GainfoOutsourceRequest request)
|
||||
{
|
||||
await SaveAsync(request);
|
||||
}
|
||||
await CheckIdNoDuplicate(request.IdNo);
|
||||
|
||||
public async Task ResignAsync(GainfoOutResignRequest request)
|
||||
{
|
||||
//todo 生成任务处理
|
||||
}
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<GainfoEntity>();
|
||||
entity.No = Guid.NewGuid().ToString();
|
||||
entity.Code = await GetOutSourceCodeAsync();
|
||||
|
||||
public async Task EditAsync(GainfoOutEntryRequest request)
|
||||
{
|
||||
await SaveAsync(request);
|
||||
await _dbContext.InsertAsync(entity);
|
||||
await _dbContext.InsertAsync(new OutsourceEntity
|
||||
{
|
||||
Code = entity.Code,
|
||||
Supplier = request.ExternalInfo.Supplier,
|
||||
SapCode = request.ExternalInfo.SapCode,
|
||||
SapPhone = request.ExternalInfo.SapPhone
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _dbContext.Queryable<GainfoEntity>().FirstAsync(x => x.Id == request.Id);
|
||||
entity.ThrowIfNull("档案数据不存在");
|
||||
|
||||
var outsource = await _dbContext.Queryable<OutsourceEntity>().FirstAsync(x => x.Code == entity.Code);
|
||||
(outsource == null).ThrowIfTrue("不可编辑非外包人员档案数据");
|
||||
|
||||
request.Adapt(entity);
|
||||
request.ExternalInfo.Adapt(outsource);
|
||||
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
await _dbContext.UpdateAsync(outsource);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,45 +61,28 @@ public class GainfoOutSourceService : IGainfoOutSourceService
|
||||
{
|
||||
await using var handler = await _redisCache.LockAsync("gainfo:outsource:code-generate", expiry: TimeSpan.FromSeconds(3), retryInterval: TimeSpan.FromSeconds(1), retryCount: 3);
|
||||
handler.Acquired.ThrowIfFalse("生成虚拟工号失败");
|
||||
|
||||
|
||||
int code;
|
||||
var entity = await _dbContext.Queryable<OutSourceEntity>().OrderBy(x => x.Id, OrderByType.Desc).FirstAsync();
|
||||
var entity = await _dbContext.Queryable<OutsourceEntity>().OrderBy(x => x.Id, OrderByType.Desc).FirstAsync();
|
||||
if (entity == null)
|
||||
{
|
||||
code = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
code = int.Parse(entity.Code.Replace("LS", "").Replace("0", "")) + 1;
|
||||
code = int.Parse(entity.Code.Replace("LS", "").TrimStart('0')) + 1;
|
||||
}
|
||||
|
||||
return "LS" + code.ToString().PadLeft(6, '0');
|
||||
}
|
||||
|
||||
private async Task SaveAsync(GainfoOutEntryRequest request)
|
||||
/// <summary>
|
||||
/// 检查证件号重复
|
||||
/// </summary>
|
||||
/// <param name="idNo"></param>
|
||||
private async Task CheckIdNoDuplicate(string idNo)
|
||||
{
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<GainfoEntity>();
|
||||
entity.No = Guid.NewGuid().ToString();
|
||||
entity.Code = await GetOutSourceCodeAsync();
|
||||
|
||||
await _dbContext.InsertAsync(entity);
|
||||
await _dbContext.InsertAsync(new OutSourceEntity
|
||||
{
|
||||
Code = entity.Code
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _dbContext.Queryable<GainfoEntity>().FirstAsync(x => x.Id == request.Id);
|
||||
entity.ThrowIfNull("档案数据不存在");
|
||||
|
||||
(await _dbContext.Queryable<OutSourceEntity>().AnyAsync(x => x.Code == entity.Code)).ThrowIfFalse("不可编辑非外包人员档案数据");
|
||||
|
||||
request.Adapt(entity);
|
||||
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
var exists = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNo == idNo).AnyAsync();
|
||||
exists.ThrowIfTrue($"证件号{idNo}重复");
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
@@ -33,8 +33,8 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
public async Task<Pagination<BusinessPlaceResponse>> GetPlaceByGainfoAsync(DeviceAssRequest request)
|
||||
{
|
||||
var gainfo = await _gainfoStore.Queryable()
|
||||
.Where(x => x.No == request.UserNo)
|
||||
.FirstAsync();
|
||||
.Where(x => x.No == request.UserNo)
|
||||
.FirstAsync();
|
||||
|
||||
if (gainfo == null)
|
||||
{
|
||||
@@ -53,26 +53,26 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
.Where(x => deviceCodes.Contains(x.Code))
|
||||
.Where((x, dr) => dr.BusinessPlaceCode.HasValue)
|
||||
.Select((x, dr, place, ps, s) => new BusinessPlaceResponse
|
||||
{
|
||||
Id = place.Id,
|
||||
Code = place.Code,
|
||||
Status = place.Status,
|
||||
Name = place.Name,
|
||||
Catalog = place.Catalog,
|
||||
CustomCode = place.CustomCode,
|
||||
Source = place.Source,
|
||||
{
|
||||
Id = place.Id,
|
||||
Code = place.Code,
|
||||
Status = place.Status,
|
||||
Name = place.Name,
|
||||
Catalog = place.Catalog,
|
||||
CustomCode = place.CustomCode,
|
||||
Source = place.Source,
|
||||
|
||||
ShiftCode = s.Code,
|
||||
ShiftName = s.Name
|
||||
})
|
||||
.Distinct()
|
||||
.ToPageListAsync(request);
|
||||
ShiftCode = s.Code,
|
||||
ShiftName = s.Name
|
||||
})
|
||||
.Distinct()
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
|
||||
public async Task<List<GetDevicesUnderGroupByUserNoResponse>> GetDevicesUnderGroupByUserNoAsync(string userNo, Guid deviceGroupCode)
|
||||
{
|
||||
var deviceGroups = await _dbContext.Queryable<DeviceGroupEntity>().ToListAsync();
|
||||
var currentGroup = deviceGroups.Where(x => x.Code == deviceGroupCode).FirstOrDefault();
|
||||
var currentGroup = deviceGroups.FirstOrDefault(x => x.Code == deviceGroupCode);
|
||||
if (currentGroup == null)
|
||||
{
|
||||
return new List<GetDevicesUnderGroupByUserNoResponse>();
|
||||
@@ -87,46 +87,46 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
foreach (var groupcode in groups)
|
||||
{
|
||||
var nos = await _dbContext.Queryable<DeviceGroupRelationshipEntity>()
|
||||
.LeftJoin<DeviceEntity>((x, d) => x.DeviceCode == d.Code)
|
||||
.Where(x => groupcode == x.GroupCode)
|
||||
.Select((x, d) => d.UniqueNo)
|
||||
.ToListAsync();
|
||||
.LeftJoin<DeviceEntity>((x, d) => x.DeviceCode == d.Code)
|
||||
.Where(x => groupcode == x.GroupCode)
|
||||
.Select((x, d) => d.UniqueNo)
|
||||
.ToListAsync();
|
||||
|
||||
var page = await _dbContext.Queryable<DeviceEntity>()
|
||||
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
|
||||
.LeftJoin<DeviceRegistryEntity>((d, dt, dr) => d.UniqueNo == dr.DeviceUniqueNo)
|
||||
.LeftJoin<BusinessPlaceEntity>((d, dt, dr, bp) => dr.BusinessPlaceCode == bp.Code)
|
||||
.Where(d => nos.Contains(d.UniqueNo))
|
||||
.Select((d, dt, dr, bp) => new DevicePageResponse
|
||||
{
|
||||
FuncsStr = d.Funcs.ToString(),
|
||||
Brand = dt.Brand,
|
||||
Type = d.Type,
|
||||
BusinessPlaceCode = bp.Code,
|
||||
BusinessPlaceName = bp.Name,
|
||||
LastHeartbeatTime = dr.LastHeartbeatTime,
|
||||
UniqueNo = d.UniqueNo,
|
||||
Supplier = d.Supplier,
|
||||
DeployPlace = d.DeployPlace,
|
||||
DeployPosition = d.DeployPosition,
|
||||
DeployDirection = d.DeployDirection,
|
||||
TemplateCode = dt.Code,
|
||||
ConnectionInfo = d.ConnectionInfo,
|
||||
Enable = d.Enable,
|
||||
})
|
||||
.ToListAsync();
|
||||
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
|
||||
.LeftJoin<DeviceRegistryEntity>((d, dt, dr) => d.UniqueNo == dr.DeviceUniqueNo)
|
||||
.LeftJoin<BusinessPlaceEntity>((d, dt, dr, bp) => dr.BusinessPlaceCode == bp.Code)
|
||||
.Where(d => nos.Contains(d.UniqueNo))
|
||||
.Select((d, dt, dr, bp) => new DevicePageResponse
|
||||
{
|
||||
FuncsStr = d.Funcs.ToString(),
|
||||
Brand = dt.Brand,
|
||||
Type = d.Type,
|
||||
BusinessPlaceCode = bp.Code,
|
||||
BusinessPlaceName = bp.Name,
|
||||
LastHeartbeatTime = dr.LastHeartbeatTime,
|
||||
UniqueNo = d.UniqueNo,
|
||||
Supplier = d.Supplier,
|
||||
DeployPlace = d.DeployPlace,
|
||||
DeployPosition = d.DeployPosition,
|
||||
DeployDirection = d.DeployDirection,
|
||||
TemplateCode = dt.Code,
|
||||
ConnectionInfo = d.ConnectionInfo,
|
||||
Enable = d.Enable,
|
||||
})
|
||||
.ToListAsync();
|
||||
var deviceUniqueNos = page.Select(x => x.UniqueNo).ToList();
|
||||
|
||||
var balanceInfos = await _dbContext.Queryable<BalanceRecordEntity>().Where(x => x.Type == BalanceRecordTypeEnumType.Out)
|
||||
.Where(x => deviceUniqueNos.Contains(x.DeviceUniqueNo))
|
||||
.Select(x => new
|
||||
{
|
||||
x.DeviceUniqueNo,
|
||||
Amount = SqlFunc.AggregateSum(x.Amount),
|
||||
UserCount = SqlFunc.AggregateDistinctCount(x.UserCode)
|
||||
})
|
||||
.GroupBy(x => x.DeviceUniqueNo)
|
||||
.ToListAsync();
|
||||
.Where(x => deviceUniqueNos.Contains(x.DeviceUniqueNo))
|
||||
.Select(x => new
|
||||
{
|
||||
x.DeviceUniqueNo,
|
||||
Amount = SqlFunc.AggregateSum(x.Amount),
|
||||
UserCount = SqlFunc.AggregateDistinctCount(x.UserCode)
|
||||
})
|
||||
.GroupBy(x => x.DeviceUniqueNo)
|
||||
.ToListAsync();
|
||||
|
||||
page.ForEach(device =>
|
||||
{
|
||||
@@ -145,6 +145,7 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
};
|
||||
lst.Add(res);
|
||||
}
|
||||
|
||||
return lst;
|
||||
}
|
||||
|
||||
@@ -153,21 +154,21 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
var ids = await _devicePermissionService.GetAssignDeviceCodesAsync(request.UserNo);
|
||||
|
||||
var page = await _dbContext.Queryable<DeviceEntity>()
|
||||
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
|
||||
.LeftJoin<DeviceRegistryEntity>((d, dt, dr) => d.UniqueNo == dr.DeviceUniqueNo)
|
||||
.LeftJoin<BusinessPlaceEntity>((d, dt, dr, bp) => dr.BusinessPlaceCode == bp.Code)
|
||||
.WhereIF(request.DeviceType.HasValue, d => d.Type == request.DeviceType)
|
||||
.Where(d => ids.Contains(d.Code))
|
||||
.Select((d, dt, dr, bp) => new DevicePageResponse
|
||||
{
|
||||
FuncsStr = d.Funcs.ToString(),
|
||||
Brand = dt.Brand,
|
||||
Type = d.Type,
|
||||
BusinessPlaceCode = bp.Code,
|
||||
BusinessPlaceName = bp.Name,
|
||||
LastHeartbeatTime = dr.LastHeartbeatTime
|
||||
}, true)
|
||||
.ToPageListAsync(request);
|
||||
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
|
||||
.LeftJoin<DeviceRegistryEntity>((d, dt, dr) => d.UniqueNo == dr.DeviceUniqueNo)
|
||||
.LeftJoin<BusinessPlaceEntity>((d, dt, dr, bp) => dr.BusinessPlaceCode == bp.Code)
|
||||
.WhereIF(request.DeviceType.HasValue, d => d.Type == request.DeviceType)
|
||||
.Where(d => ids.Contains(d.Code))
|
||||
.Select((d, dt, dr, bp) => new DevicePageResponse
|
||||
{
|
||||
FuncsStr = d.Funcs.ToString(),
|
||||
Brand = dt.Brand,
|
||||
Type = d.Type,
|
||||
BusinessPlaceCode = bp.Code,
|
||||
BusinessPlaceName = bp.Name,
|
||||
LastHeartbeatTime = dr.LastHeartbeatTime
|
||||
}, true)
|
||||
.ToPageListAsync(request);
|
||||
|
||||
var deviceUniqueNos = page.Data.Select(x => x.UniqueNo).ToList();
|
||||
|
||||
@@ -193,7 +194,6 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
});
|
||||
|
||||
return page;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -206,8 +206,8 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
if (gainfo == null && request.IsLeave)
|
||||
{
|
||||
gainfo = await _dbContext.Queryable<GainfoEntity>().AS("GainfoLeave")
|
||||
.Where(x => x.No == request.UserNo)
|
||||
.SingleAsync();
|
||||
.Where(x => x.No == request.UserNo)
|
||||
.SingleAsync();
|
||||
|
||||
if (gainfo != null)
|
||||
{
|
||||
@@ -217,23 +217,24 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
|
||||
gainfo.ThrowIfNull("档案数据不存在");
|
||||
|
||||
//获取人员的设备权限
|
||||
var deviceCodes = await _devicePermissionService.GetAssignDeviceCodesAsync(request.UserNo);
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => deviceCodes.Contains(x.Code)).ToListAsync();
|
||||
|
||||
var tasks = devices.Select(x => new DeviceTaskEntity
|
||||
{
|
||||
UserId = gainfo.Id,
|
||||
CancellationId = 0,
|
||||
Version = 0,
|
||||
UserId = gainfo!.Id,
|
||||
Source = null,
|
||||
DeviceUniqueNo = x.UniqueNo,
|
||||
Status = DeviceTaskStatusEnumType.Wait,
|
||||
UserNo = request.UserNo,
|
||||
Type = request.IsLeave ? DeviceTaskEnumType.Delete : DeviceTaskEnumType.Add,
|
||||
Type = request.IsLeave
|
||||
? DeviceTaskEnumType.Delete
|
||||
: DeviceTaskEnumType.Add,
|
||||
DeviceType = x.Type,
|
||||
TenantId = gainfo.Factory,
|
||||
Priority = 10
|
||||
})
|
||||
.ToList();
|
||||
}).ToList();
|
||||
|
||||
await _dbContext.InsertAsync(tasks);
|
||||
}
|
||||
@@ -258,4 +259,4 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
|
||||
yield return current.Code;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,11 @@ using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Scheduled.Api;
|
||||
using Dlhis.Scheduled.Api.Request;
|
||||
using Dlhis.Sys.Api;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.Core.User.Abstractions;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using SqlSugar;
|
||||
|
||||
@@ -23,6 +23,7 @@ public class GainfoService : IGainfoService
|
||||
private readonly ICurrentUser _currentUser;
|
||||
private readonly ITenantApi _tenantApi;
|
||||
private readonly IHangfireApi _hangfireApi;
|
||||
private readonly IGainfoPermissionService _gainfoPermissionService;
|
||||
private readonly ILogger<GainfoService> _logger;
|
||||
|
||||
public GainfoService(IGainfoStore gainfoStore,
|
||||
@@ -31,6 +32,7 @@ public class GainfoService : IGainfoService
|
||||
ICurrentUser currentUser,
|
||||
ITenantApi tenantApi,
|
||||
IHangfireApi hangfireApi,
|
||||
IGainfoPermissionService gainfoPermissionService,
|
||||
ILogger<GainfoService> logger)
|
||||
{
|
||||
_gainfoStore = gainfoStore;
|
||||
@@ -39,6 +41,7 @@ public class GainfoService : IGainfoService
|
||||
_currentUser = currentUser;
|
||||
_tenantApi = tenantApi;
|
||||
_hangfireApi = hangfireApi;
|
||||
_gainfoPermissionService = gainfoPermissionService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -55,18 +58,17 @@ public class GainfoService : IGainfoService
|
||||
var where = LinqExpressionExtensions.False<GainfoEntity>();
|
||||
foreach (var item in request.DepartmentSelections)
|
||||
{
|
||||
var depts = await GetRecursionDepartmentNosAsync(item.DepartmentNos);
|
||||
if (depts.Any())
|
||||
where = where.Or(gainfo => gainfo.Factory == item.Tenant && depts.Contains(gainfo.DepartmentNo));
|
||||
else
|
||||
where = where.Or(gainfo => gainfo.Factory == item.Tenant);
|
||||
var searchDepartments = await GetRecursionDepartmentNosAsync(item.DepartmentNos);
|
||||
where = searchDepartments.Any()
|
||||
? where.Or(gainfo => gainfo.Factory == item.Tenant && searchDepartments.Contains(gainfo.DepartmentNo))
|
||||
: where.Or(gainfo => gainfo.Factory == item.Tenant);
|
||||
}
|
||||
|
||||
var page = await _gainfoStore.Queryable(request.Status)
|
||||
.WhereIF(request.DepartmentSelections.IsPresent(), where)
|
||||
.WhereIF(request.DepartmentSelections.IsEmpty(), gainfo => gainfo.Factory == currentTenantId)
|
||||
.WhereIF(request.IsOutSource.HasValue && request.IsOutSource.Value, gainfo => SqlFunc.Subqueryable<OutSourceEntity>().Where(x => x.Code == gainfo.Code).Any())
|
||||
.WhereIF(request.IsOutSource.HasValue && !request.IsOutSource.Value, gainfo => SqlFunc.Subqueryable<OutSourceEntity>().Where(x => x.Code == gainfo.Code).NotAny())
|
||||
.WhereIF(request.IsOutsource.HasValue && request.IsOutsource.Value, gainfo => SqlFunc.Subqueryable<OutsourceEntity>().Where(x => x.Code == gainfo.Code).Any())
|
||||
.WhereIF(request.IsOutsource.HasValue && !request.IsOutsource.Value, gainfo => SqlFunc.Subqueryable<OutsourceEntity>().Where(x => x.Code == gainfo.Code).NotAny())
|
||||
.WhereIF(request.Search.IsPresent(), gainfo =>
|
||||
gainfo.Name.Contains(request.Search)
|
||||
|| gainfo.Code == request.Search
|
||||
@@ -106,7 +108,6 @@ public class GainfoService : IGainfoService
|
||||
}
|
||||
|
||||
var gainfo = await _gainfoStore.Queryable().Where(x => x.Code == code).SingleAsync();
|
||||
|
||||
if (gainfo == null)
|
||||
{
|
||||
//开启同步处理
|
||||
@@ -132,21 +133,21 @@ public class GainfoService : IGainfoService
|
||||
{
|
||||
Balance = mealUser.Balance
|
||||
}
|
||||
})
|
||||
.FirstAsync();
|
||||
}).SingleAsync();
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var tenantResult = await _tenantApi.GetTenantByCodeAsync(info.Factory);
|
||||
if (tenantResult != null && tenantResult.Data != null)
|
||||
if (tenantResult is { Data: not null })
|
||||
{
|
||||
info.Factory = tenantResult.Data.Name;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,6 +168,39 @@ public class GainfoService : IGainfoService
|
||||
return protector.Protect(request.IdNo);
|
||||
}
|
||||
|
||||
|
||||
public async Task ResignAsync(GainfoResignRequest request)
|
||||
{
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().FirstAsync(x => x.Id == request.Id);
|
||||
gainfo.ThrowIfNull("档案数据不存在");
|
||||
|
||||
if (request.IsOutsource)
|
||||
{
|
||||
var outsource = await _dbContext.Queryable<OutsourceEntity>().FirstAsync(x => x.Code == gainfo.Code);
|
||||
(outsource == null).ThrowIfTrue("非外包人员不可手动离职");
|
||||
}
|
||||
|
||||
await _gainfoPermissionService.ResetPermissionsAsync(new GainfoPermissionResetRequest
|
||||
{
|
||||
UserNo = gainfo.No,
|
||||
IsLeave = true
|
||||
});
|
||||
|
||||
//先写入离职表
|
||||
gainfo.IdentityUserId = (int)gainfo.Id; //记录原始id
|
||||
gainfo.ResignationDate = request.Date;
|
||||
gainfo.Remark = request.Reason;
|
||||
gainfo.Id = 0;
|
||||
|
||||
if (!await _dbContext.Queryable<GainfoEntity>().AS("GainfoLeave").AnyAsync(x => x.Code == gainfo.Code))
|
||||
{
|
||||
await _dbContext.Client.Insertable(gainfo).AS("GainfoLeave").ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
gainfo.Id = gainfo.IdentityUserId;
|
||||
await _dbContext.DeleteReallyAsync(gainfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 档案列表
|
||||
/// </summary>
|
||||
@@ -192,6 +226,7 @@ public class GainfoService : IGainfoService
|
||||
DepartmentName = de.Name,
|
||||
Address = ga.Address,
|
||||
}).ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Reflection;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Dlhis.Basic.Organization.Request;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Packs;
|
||||
@@ -58,16 +58,16 @@ public class SqlSugarPack : BaseAppPack
|
||||
{
|
||||
using var scope = app.ApplicationServices.CreateScope();
|
||||
var db = scope.ServiceProvider.GetService<IDbContext>();
|
||||
var tables = App.ActiveTyps.Where(x => x.IsDefined(typeof(SugarTable), false))
|
||||
.Where(x => !x.IsDefined(typeof(SkipScanAttribute), false))
|
||||
.ToArray();
|
||||
|
||||
db.Client.DbMaintenance.CreateDatabase();
|
||||
db.Client.CodeFirst.InitTables(tables);
|
||||
|
||||
var faceDb = db.ChangeDb("face");
|
||||
faceDb.Client.DbMaintenance.CreateDatabase();
|
||||
faceDb.Client.CodeFirst.InitTables<GainfoFaceEntity>();
|
||||
// var tables = App.ActiveTyps.Where(x => x.IsDefined(typeof(SugarTable), false))
|
||||
// .Where(x => !x.IsDefined(typeof(SkipScanAttribute), false))
|
||||
// .ToArray();
|
||||
//
|
||||
// db.Client.DbMaintenance.CreateDatabase();
|
||||
// db.Client.CodeFirst.InitTables(tables);
|
||||
//
|
||||
// var faceDb = db.ChangeDb("face");
|
||||
// faceDb.Client.DbMaintenance.CreateDatabase();
|
||||
// faceDb.Client.CodeFirst.InitTables<GainfoFaceEntity>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,10 @@
|
||||
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 Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
|
||||
namespace Dlhis.Basic.Places.Controllers;
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessPlace.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Dlhis.Basic.Places.Dto;
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Dlhis.Basic.Places.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Dlhis.Basic.Places.Dtos;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Controllers;
|
||||
namespace Dlhis.Basic.Places.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 营业点权限管理
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessPlace.Services;
|
||||
using Dlhis.Basic.BusinessShift.Services;
|
||||
using Dlhis.Basic.BusinessShift.Services;
|
||||
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 Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Controllers;
|
||||
namespace Dlhis.Basic.Places.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.Basic.Places.Dtos;
|
||||
namespace Dlhis.Basic.Places.Dto;
|
||||
|
||||
public class BusinessPlaceDto
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Places.Request;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Places.Request
|
||||
{
|
||||
@@ -11,4 +11,4 @@ namespace Dlhis.Basic.Places.Request
|
||||
[Required(ErrorMessage = "营业点号不能为空")]
|
||||
public string Code { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Places.Request;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Places.Request;
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Response;
|
||||
namespace Dlhis.Basic.Places.Response;
|
||||
|
||||
public class BusinessPlaceListResponse : BusinessPlaceResponse
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.Basic.BusinessPlace.Response;
|
||||
namespace Dlhis.Basic.Places.Response;
|
||||
|
||||
public class BusinessPlacePermissionPageResponse
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Response;
|
||||
namespace Dlhis.Basic.Places.Response;
|
||||
|
||||
public class BusinessPlaceResponse
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Response;
|
||||
namespace Dlhis.Basic.Places.Response;
|
||||
|
||||
public class BusinessPlaceWithShiftResponse
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Dlhis.Basic.BusinessPlace.Response
|
||||
namespace Dlhis.Basic.Places.Response
|
||||
{
|
||||
public class DeviceCodeNameDetail
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Places.Services;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Dlhis.Basic.Places.Dtos;
|
||||
using Dlhis.Basic.Places.Dto;
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Services;
|
||||
namespace Dlhis.Basic.Places.Services;
|
||||
|
||||
public interface IBusinessPlacePermissionsService : IScopeDependency
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Services;
|
||||
namespace Dlhis.Basic.Places.Services;
|
||||
|
||||
public interface IBusinessPlaceService : IScopeDependency
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
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;
|
||||
@@ -46,8 +46,8 @@ public class BookingAddressService : IBookingAddressService
|
||||
public async Task<List<BookingAddressPageResponse>> GetAllAddressAsync(string tenant)
|
||||
{
|
||||
return await _dbContext.Queryable<BookingAddressEntity>()
|
||||
.Where(x => x.TenantId == tenant)
|
||||
.Select<BookingAddressPageResponse>()
|
||||
.ToListAsync();
|
||||
.Where(x => x.TenantId == tenant)
|
||||
.Select<BookingAddressPageResponse>()
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,15 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using System.Security.Claims;
|
||||
using Dlhis.Basic.Places.Dto;
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.Places.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;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Services.Implements;
|
||||
namespace Dlhis.Basic.Places.Services.Implements;
|
||||
|
||||
public class BusinessPlacePermissionsService : IBusinessPlacePermissionsService
|
||||
{
|
||||
@@ -41,10 +39,7 @@ public class BusinessPlacePermissionsService : IBusinessPlacePermissionsService
|
||||
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;
|
||||
});
|
||||
page.Data.ForEach(item => { item.UserName = users.FirstOrDefault(x => x.Id == item.UserId)?.UserName; });
|
||||
|
||||
return page;
|
||||
}
|
||||
@@ -59,16 +54,16 @@ public class BusinessPlacePermissionsService : IBusinessPlacePermissionsService
|
||||
if (isAdmin)
|
||||
{
|
||||
codes = await _dbContext.Queryable<BusinessPlaceEntity>()
|
||||
.Select(x => x.Code)
|
||||
.ToListAsync();
|
||||
.Select(x => x.Code)
|
||||
.ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
codes = await _dbContext.Queryable<BusinessPlaceManagerRelationshipEntity>()
|
||||
.Where(x => x.ManagerUserId == userId)
|
||||
.Select(x => x.BusinessPlaceCode)
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
.Where(x => x.ManagerUserId == userId)
|
||||
.Select(x => x.BusinessPlaceCode)
|
||||
.Distinct()
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
@@ -80,11 +75,9 @@ public class BusinessPlacePermissionsService : IBusinessPlacePermissionsService
|
||||
|
||||
public async Task SaveBusinessPlacePermissionAsync(BusinessPlacePermissionSaveRequest request)
|
||||
{
|
||||
var userId = _currentUser.GetIntSubjectId();
|
||||
|
||||
await _dbContext.Client.Deleteable<BusinessPlaceManagerRelationshipEntity>()
|
||||
.Where(x => x.ManagerUserId == request.UserId)
|
||||
.ExecuteCommandAsync();
|
||||
.Where(x => x.ManagerUserId == request.UserId)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
await _dbContext.InsertAsync(request.BusinessPlaceCodes.Select(x => new BusinessPlaceManagerRelationshipEntity
|
||||
{
|
||||
@@ -96,23 +89,20 @@ public class BusinessPlacePermissionsService : IBusinessPlacePermissionsService
|
||||
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();
|
||||
.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;
|
||||
});
|
||||
infos.ForEach(item => { item.UserName = user?.UserName; });
|
||||
|
||||
return infos;
|
||||
}
|
||||
@@ -121,4 +111,4 @@ public class BusinessPlacePermissionsService : IBusinessPlacePermissionsService
|
||||
{
|
||||
await _dbContext.Client.Deleteable<BusinessPlaceManagerRelationshipEntity>().Where(x => x.Id == id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
using Dlhis.Basic.Places.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.Places.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Services.Implements;
|
||||
namespace Dlhis.Basic.Places.Services.Implements;
|
||||
|
||||
public class BusinessPlaceService : IBusinessPlaceService
|
||||
{
|
||||
@@ -28,26 +28,27 @@ public class BusinessPlaceService : IBusinessPlaceService
|
||||
var page = await _dbContext.Queryable<BusinessPlaceEntity>()
|
||||
.LeftJoin<BusinessPlaceShiftRelationshipEntity>((x, ps) => x.Code == ps.PlaceCode)
|
||||
.LeftJoin<BusinessShiftEntity>((x, ps, s) => s.Code == ps.ShiftCode)
|
||||
.WhereIF(request.Search.IsPresent(), x => x.CustomCode.Contains(request.Search)
|
||||
|| x.Code.ToString().Contains(request.Search) || x.Name.Contains(request.Search))
|
||||
.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,
|
||||
Code = x.Code,
|
||||
Status = x.Status,
|
||||
Name = x.Name,
|
||||
Catalog = x.Catalog,
|
||||
CustomCode = x.CustomCode,
|
||||
Source = x.Source,
|
||||
Supplier = x.Supplier,
|
||||
ShiftCode = s.Code,
|
||||
ShiftName = s.Name
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
.WhereIF(request.Search.IsPresent(), x => x.CustomCode.Contains(request.Search)
|
||||
|| x.Code.ToString().Contains(request.Search)
|
||||
|| x.Name.Contains(request.Search))
|
||||
.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,
|
||||
Code = x.Code,
|
||||
Status = x.Status,
|
||||
Name = x.Name,
|
||||
Catalog = x.Catalog,
|
||||
CustomCode = x.CustomCode,
|
||||
Source = x.Source,
|
||||
Supplier = x.Supplier,
|
||||
ShiftCode = s.Code,
|
||||
ShiftName = s.Name
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
@@ -56,25 +57,25 @@ public class BusinessPlaceService : IBusinessPlaceService
|
||||
public async Task<List<BusinessPlaceListResponse>> GetOpenedListAsync(Guid? placeCode = null, string tenant = null)
|
||||
{
|
||||
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)
|
||||
.Select((x, ps, s) => new BusinessPlaceListResponse
|
||||
{
|
||||
Id = x.Id,
|
||||
Code = x.Code,
|
||||
Status = x.Status,
|
||||
Name = x.Name,
|
||||
Catalog = x.Catalog,
|
||||
CustomCode = x.CustomCode,
|
||||
Source = x.Source,
|
||||
Supplier = x.Supplier,
|
||||
ShiftCode = s.Code,
|
||||
ShiftName = s.Name,
|
||||
})
|
||||
.ToListAsync();
|
||||
.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)
|
||||
.Select((x, ps, s) => new BusinessPlaceListResponse
|
||||
{
|
||||
Id = x.Id,
|
||||
Code = x.Code,
|
||||
Status = x.Status,
|
||||
Name = x.Name,
|
||||
Catalog = x.Catalog,
|
||||
CustomCode = x.CustomCode,
|
||||
Source = x.Source,
|
||||
Supplier = x.Supplier,
|
||||
ShiftCode = s.Code,
|
||||
ShiftName = s.Name,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var shiftCodes = list.Where(x => x.ShiftCode.HasValue).Select(x => x.ShiftCode.Value).ToList();
|
||||
|
||||
@@ -88,8 +89,8 @@ public class BusinessPlaceService : IBusinessPlaceService
|
||||
if (item.ShiftCode.HasValue)
|
||||
{
|
||||
item.ShiftTypes = shiftTypes.Where(x => x.ShiftCode == item.ShiftCode.Value)
|
||||
.Select(x => new Dictionary<int, string>() { [(int)x.ShiftType] = x.ShiftType.GetDescription() })
|
||||
.ToList();
|
||||
.Select(x => new Dictionary<int, string>() { [(int)x.ShiftType] = x.ShiftType.GetDescription() })
|
||||
.ToList();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -149,9 +150,9 @@ public class BusinessPlaceService : IBusinessPlaceService
|
||||
private async Task CheckExistsCustomCodeAsync(BusinessPlaceSaveRequest request)
|
||||
{
|
||||
var existsSameCustomCode = await _dbContext.Queryable<BusinessPlaceEntity>()
|
||||
.Where(x => x.CustomCode == request.CustomCode)
|
||||
.WhereIF(request.Id.HasValue, x => x.Id != request.Id)
|
||||
.AnyAsync();
|
||||
.Where(x => x.CustomCode == request.CustomCode)
|
||||
.WhereIF(request.Id.HasValue, x => x.Id != request.Id)
|
||||
.AnyAsync();
|
||||
|
||||
existsSameCustomCode.ThrowIfTrue($"自定义手工号[{request.CustomCode}]存在重复,请检查.");
|
||||
}
|
||||
@@ -164,4 +165,4 @@ public class BusinessPlaceService : IBusinessPlaceService
|
||||
{
|
||||
return (await _businessPlacePermissionsService.GetMyAsync()).Select(x => x.Code).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user