fix 补充注释,接口兼容设备

This commit is contained in:
2024-01-03 17:34:19 +08:00
parent ebffe59360
commit bcec08d10a
13 changed files with 88 additions and 35 deletions

View File

@@ -14,6 +14,11 @@ public class BusinessPlaceShiftResponse
/// </summary>
public string BusinessPlaceCustomCode { get; set; }
/// <summary>
/// 营业点
/// </summary>
public string BusinessPlace { get; set; }
/// <summary>
/// 代号
/// </summary>

View File

@@ -1,4 +1,5 @@
using Dlhis.Basic.BusinessShift.Request;
using Dlhis.Basic.BusinessPlace.Response;
using Dlhis.Basic.BusinessShift.Request;
using Dlhis.Basic.BusinessShift.Response;
using Kurisu.Core.DataAccess.Dto;
@@ -10,5 +11,5 @@ public interface IBusinessPlaceShiftService : IScopeDependency
Task SaveAsync(BusinessPlaceShiftSaveRequest request);
Task<List<BusinessPlaceShiftResponse>> GetShiftsByPlaceCustomCodeAsync(string placeCustomCode);
Task<BusinessPlaceWithShiftResponse> GetShiftsByPlaceCustomCodeAsync(string placeCustomCode);
}

View File

@@ -1,4 +1,5 @@
using Dlhis.Basic.BusinessShift.Request;
using Dlhis.Basic.BusinessPlace.Response;
using Dlhis.Basic.BusinessShift.Request;
using Dlhis.Basic.BusinessShift.Response;
using Dlhis.Entity.Basic.Entity;
using Kurisu.AspNetCore.Utils.Extensions;
@@ -29,6 +30,7 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
Id = shift.Id,
BusinessPlaceCode = place.Code,
BusinessPlaceCustomCode = place.CustomCode,
BusinessPlace = place.Name,
Code = shift.Code,
CustomCode = shift.CustomCode,
Name = shift.Name,
@@ -66,24 +68,36 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
}
public async Task<List<BusinessPlaceShiftResponse>> GetShiftsByPlaceCustomCodeAsync(string placeCustomCode)
public async Task<BusinessPlaceWithShiftResponse> GetShiftsByPlaceCustomCodeAsync(string placeCustomCode)
{
return await _dbContext.Queryable<CanteenBusinessShiftEntity>()
.LeftJoin<CanteenBusinessPlaceEntity>((shift, place) => shift.BusinessPlaceCode == place.Code)
.Where((shift, place) => place.CustomCode == placeCustomCode)
.OrderBy((shift, place) => shift.Start)
.Select((shift, place) => new BusinessPlaceShiftResponse
{
Id = shift.Id,
BusinessPlaceCode = place.Code,
BusinessPlaceCustomCode = place.CustomCode,
Code = shift.Code,
CustomCode = shift.CustomCode,
Name = shift.Name,
Start = shift.Start,
End = shift.End
})
.ToListAsync();
var place = await _dbContext.Queryable<CanteenBusinessPlaceEntity>().Where(x => x.CustomCode == placeCustomCode).FirstAsync();
if (place == null)
{
return new BusinessPlaceWithShiftResponse()
{
Shifts = new List<BusinessPlaceShiftResponse>()
};
}
var shifts = await _dbContext.Queryable<CanteenBusinessShiftEntity>().Where(x => x.BusinessPlaceCode == place.Code).ToListAsync();
return new BusinessPlaceWithShiftResponse
{
CustomCode = placeCustomCode,
Name = place.Name,
Shifts = shifts.Select(shift => new BusinessPlaceShiftResponse
{
Id = shift.Id,
BusinessPlaceCode = place.Code,
BusinessPlaceCustomCode = place.CustomCode,
BusinessPlace = place.Name,
Code = shift.Code,
CustomCode = shift.CustomCode,
Name = shift.Name,
Start = shift.Start,
End = shift.End
})
.ToList()
};
}
//*********************************************** help methods ***************************************************//