init 项目代码初始化
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessPlace.Services;
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
using Dlhis.Basic.BusinessShift.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class BusinessPlacesController : ControllerBase
|
||||
{
|
||||
private readonly IBusinessPlaceService _businessPlaceService;
|
||||
private readonly IBusinessPlaceShiftService _businessPlaceShiftService;
|
||||
|
||||
public BusinessPlacesController(IBusinessPlaceService businessPlaceService,
|
||||
IBusinessPlaceShiftService businessPlaceShiftService)
|
||||
{
|
||||
_businessPlaceService = businessPlaceService;
|
||||
_businessPlaceShiftService = businessPlaceShiftService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 营业点分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<BusinessPlaceResponse>> GetPageAsync([FromQuery] BusinessPlacePageRequest request)
|
||||
{
|
||||
return await _businessPlaceService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取启用的营业点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
public async Task<List<BusinessPlaceResponse>> GetOpenedListAsync()
|
||||
{
|
||||
return await _businessPlaceService.GetOpenedListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 营业点保存
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("save")]
|
||||
public async Task SaveAsync(BusinessPlaceSaveRequest request)
|
||||
{
|
||||
await _businessPlaceService.SaveAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据手工号获取餐别
|
||||
/// </summary>
|
||||
/// <param name="placeCustomCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("shifts")]
|
||||
public async Task<List<BusinessPlaceShiftResponse>> GetShiftsByPlaceCustomCodeAsync(string placeCustomCode)
|
||||
{
|
||||
return await _businessPlaceShiftService.GetShiftsByPlaceCustomCodeAsync(placeCustomCode);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Request;
|
||||
|
||||
public class BusinessPlacePageRequest : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 状态 CanteenBusinessPlaceStatusEnumType
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(CanteenBusinessPlaceStatusEnumType))]
|
||||
public CanteenBusinessPlaceStatusEnumType? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源 CanteenBusinessPlaceSourceEnumType
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(CanteenBusinessPlaceSourceEnumType))]
|
||||
public CanteenBusinessPlaceSourceEnumType? Source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类 CanteenBusinessPlaceCatalogEnumType
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(CanteenBusinessPlaceCatalogEnumType))]
|
||||
public CanteenBusinessPlaceCatalogEnumType? Catalog { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Request;
|
||||
|
||||
/// <summary>
|
||||
/// 营业点保存参数
|
||||
/// </summary>
|
||||
public class BusinessPlaceSaveRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 为null则更新
|
||||
/// </summary>
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义代号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "手工号不能为空")]
|
||||
public string CustomCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点名称
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "营业点名称不能为空")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态 CanteenBusinessPlaceStatusEnumType
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(CanteenBusinessPlaceStatusEnumType))]
|
||||
public CanteenBusinessPlaceStatusEnumType Status { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 来源 CanteenBusinessPlaceSourceEnumType
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(CanteenBusinessPlaceSourceEnumType))]
|
||||
public CanteenBusinessPlaceSourceEnumType Source { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 分类 CanteenBusinessPlaceCatalogEnumType
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(CanteenBusinessPlaceCatalogEnumType))]
|
||||
public CanteenBusinessPlaceCatalogEnumType Catalog { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Response;
|
||||
|
||||
public class BusinessPlaceResponse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 代号
|
||||
/// </summary>
|
||||
public Guid Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义代号
|
||||
/// </summary>
|
||||
public string CustomCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 营业点名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态,停用/启用
|
||||
/// </summary>
|
||||
public CanteenBusinessPlaceStatusEnumType Status { get; set; }
|
||||
public string StatusDesc => Status.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 来源,自营/合作/外包
|
||||
/// </summary>
|
||||
public CanteenBusinessPlaceSourceEnumType Source { get; set; }
|
||||
public string SourceDesc => Source.GetDescription();
|
||||
|
||||
/// <summary>
|
||||
/// 分类,超市/餐厅/食堂
|
||||
/// </summary>
|
||||
public CanteenBusinessPlaceCatalogEnumType Catalog { get; set; }
|
||||
public string CatalogDesc => Catalog.GetDescription();
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Attributes;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Services;
|
||||
|
||||
public interface IBusinessPlaceService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<BusinessPlaceResponse>> GetPageAsync(BusinessPlacePageRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 获取可用的营业点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<BusinessPlaceResponse>> GetOpenedListAsync();
|
||||
|
||||
|
||||
Task SaveAsync(BusinessPlaceSaveRequest request);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using Dlhis.Basic.BusinessPlace.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Attributes;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.BusinessPlace.Services.Implements;
|
||||
|
||||
public class BusinessPlaceService : IBusinessPlaceService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public BusinessPlaceService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
[IgnoreTenant]
|
||||
public async Task<Pagination<BusinessPlaceResponse>> GetPageAsync(BusinessPlacePageRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<CanteenBusinessPlaceEntity>()
|
||||
.WhereIF(request.Search.IsPresent(), x => x.CustomCode.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)
|
||||
.Select<BusinessPlaceResponse>()
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<BusinessPlaceResponse>> GetOpenedListAsync()
|
||||
{
|
||||
return await _dbContext.Queryable<CanteenBusinessPlaceEntity>()
|
||||
.Where(x => x.Status == CanteenBusinessPlaceStatusEnumType.Opened)
|
||||
.Select<BusinessPlaceResponse>()
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task SaveAsync(BusinessPlaceSaveRequest request)
|
||||
{
|
||||
await CheckExistsCustomCodeAsync(request);
|
||||
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<CanteenBusinessPlaceEntity>();
|
||||
entity.Code = Guid.NewGuid();
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _dbContext.Queryable<CanteenBusinessPlaceEntity>().FirstAsync(x => x.Id == request.Id);
|
||||
request.Adapt(entity);
|
||||
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************** help methods ***************************************************//
|
||||
|
||||
/// <summary>
|
||||
/// 检查重复手工号
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
private async Task CheckExistsCustomCodeAsync(BusinessPlaceSaveRequest request)
|
||||
{
|
||||
var existsSameCustomCode = await _dbContext.Queryable<CanteenBusinessPlaceEntity>()
|
||||
.Where(x => x.CustomCode == request.CustomCode)
|
||||
.WhereIF(request.Id.HasValue, x => x.Id != request.Id)
|
||||
.AnyAsync();
|
||||
|
||||
existsSameCustomCode.ThrowIfTrue($"自定义手工号[{request.CustomCode}]存在重复,请检查.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
using Dlhis.Basic.BusinessShift.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.BusinessShift.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 餐次
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class BusinessShiftsController : ControllerBase
|
||||
{
|
||||
private readonly IBusinessPlaceShiftService _businessPlaceShiftService;
|
||||
|
||||
public BusinessShiftsController(IBusinessPlaceShiftService businessPlaceShiftService)
|
||||
{
|
||||
_businessPlaceShiftService = businessPlaceShiftService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 餐次分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<BusinessPlaceShiftResponse>> GetPageAsync([FromQuery] BusinessPlaceShiftPageRequest request)
|
||||
{
|
||||
return await _businessPlaceShiftService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 餐次保存
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("save")]
|
||||
public async Task SaveAsync(BusinessPlaceShiftSaveRequest request)
|
||||
{
|
||||
await _businessPlaceShiftService.SaveAsync(request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.BusinessShift.Request;
|
||||
|
||||
public class BusinessPlaceShiftPageRequest : PageDto
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Kurisu.Core.CustomClass;
|
||||
|
||||
namespace Dlhis.Basic.BusinessShift.Request;
|
||||
|
||||
public class BusinessPlaceShiftSaveRequest : IValidatableObject
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点代号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "营业点不能为空")]
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义代号
|
||||
/// </summary>
|
||||
public string CustomCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次名称
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "餐次名称不能为空")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间段
|
||||
/// </summary>
|
||||
public TimePeriod TimePeriod { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (TimePeriod.Start == TimePeriod.End)
|
||||
{
|
||||
yield return new ValidationResult("时间段设置区间有误,开始时段不能等于结束时段.", new[] { nameof(TimePeriod) });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
namespace Dlhis.Basic.BusinessShift.Response;
|
||||
|
||||
public class BusinessPlaceShiftResponse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点代号
|
||||
/// </summary>
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点手工号
|
||||
/// </summary>
|
||||
public string BusinessPlaceCustomCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 代号
|
||||
/// </summary>
|
||||
public Guid Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自定义代号
|
||||
/// </summary>
|
||||
public string CustomCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐次名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 经营开始时间
|
||||
/// </summary>
|
||||
public TimeOnly Start { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 经营结束时间
|
||||
/// </summary>
|
||||
public TimeOnly End { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.BusinessShift.Services;
|
||||
|
||||
public interface IBusinessPlaceShiftService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<BusinessPlaceShiftResponse>> GetPageAsync(BusinessPlaceShiftPageRequest request);
|
||||
|
||||
Task SaveAsync(BusinessPlaceShiftSaveRequest request);
|
||||
|
||||
Task<List<BusinessPlaceShiftResponse>> GetShiftsByPlaceCustomCodeAsync(string placeCustomCode);
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.CustomClass;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.BusinessShift.Services.Implements;
|
||||
|
||||
public class BusinessPlaceShiftService : IBusinessPlaceShiftService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public BusinessPlaceShiftService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<Pagination<BusinessPlaceShiftResponse>> GetPageAsync(BusinessPlaceShiftPageRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<CanteenBusinessShiftEntity>()
|
||||
.LeftJoin<CanteenBusinessPlaceEntity>((shift, place) => shift.BusinessPlaceCode == place.Code)
|
||||
.WhereIF(request.Search.IsPresent(), (shift, place) => shift.CustomCode.Contains(request.Search) || shift.Name.Contains(request.Search))
|
||||
.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
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
public async Task SaveAsync(BusinessPlaceShiftSaveRequest request)
|
||||
{
|
||||
await CheckExistsCustomCodeAsync(request);
|
||||
await DuplicateTimePeriodAsync(request);
|
||||
await CheckPlaceExistsAsync(request.BusinessPlaceCode);
|
||||
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<CanteenBusinessShiftEntity>();
|
||||
|
||||
entity.Code = Guid.NewGuid();
|
||||
entity.Start = request.TimePeriod.Start.Value;
|
||||
entity.End = request.TimePeriod.End.Value;
|
||||
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _dbContext.Queryable<CanteenBusinessShiftEntity>().FirstAsync(x => x.Id == request.Id);
|
||||
entity.Adapt(request);
|
||||
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<BusinessPlaceShiftResponse>> 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();
|
||||
}
|
||||
|
||||
//*********************************************** help methods ***************************************************//
|
||||
|
||||
|
||||
private async Task CheckPlaceExistsAsync(Guid code)
|
||||
{
|
||||
var existsPlace = await _dbContext.Queryable<CanteenBusinessPlaceEntity>().AnyAsync(x => x.Code == code);
|
||||
existsPlace.ThrowIfFalse("营业点不存在,请检查.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 时间段重合检查
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
private async Task DuplicateTimePeriodAsync(BusinessPlaceShiftSaveRequest request)
|
||||
{
|
||||
var periods = await _dbContext.Queryable<CanteenBusinessShiftEntity>()
|
||||
.Where(x => x.BusinessPlaceCode == request.BusinessPlaceCode)
|
||||
.WhereIF(request.Id.HasValue, x => x.Id != request.Id)
|
||||
.Select(x => new TimePeriod
|
||||
{
|
||||
Start = x.Start,
|
||||
End = x.End,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var period in periods)
|
||||
{
|
||||
period.IsDuplicate(request.TimePeriod).ThrowIfTrue($"存在时间段重合[{period.Start}-{period.End}]");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检查重复手工号
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
private async Task CheckExistsCustomCodeAsync(BusinessPlaceShiftSaveRequest request)
|
||||
{
|
||||
var existsSameCustomCode = await _dbContext.Queryable<CanteenBusinessShiftEntity>()
|
||||
.Where(x => x.CustomCode == request.CustomCode)
|
||||
.WhereIF(request.Id.HasValue, x => x.Id != request.Id)
|
||||
.AnyAsync();
|
||||
|
||||
existsSameCustomCode.ThrowIfTrue($"自定义手工号[{request.CustomCode}]存在重复,请检查.");
|
||||
}
|
||||
}
|
||||
59
Src/Dlhis.Basic/Device/Controllers/DevicesController.cs
Normal file
59
Src/Dlhis.Basic/Device/Controllers/DevicesController.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.Device.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 设备控制器
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class DevicesController : ControllerBase
|
||||
{
|
||||
private readonly IDeviceService _deviceService;
|
||||
private readonly IDeviceTemplateService _deviceTemplateService;
|
||||
|
||||
public DevicesController(IDeviceService deviceService, IDeviceTemplateService deviceTemplateService)
|
||||
{
|
||||
_deviceService = deviceService;
|
||||
_deviceTemplateService = deviceTemplateService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备模板
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("template/page")]
|
||||
public async Task<Pagination<DeviceTemplateResponse>> GetTemplatePageAsync([FromQuery] DeviceTemplatePageRequest request)
|
||||
{
|
||||
return await _deviceTemplateService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备模板保存
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("template")]
|
||||
public async Task SaveTemplateAsync(DeviceTemplateSaveRequest request)
|
||||
{
|
||||
await _deviceTemplateService.SaveTemplateAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<DeviceResponse>> GetPageAsync([FromQuery] DevicePageRequest request)
|
||||
{
|
||||
return await _deviceService.GetPageAsync(request);
|
||||
}
|
||||
}
|
||||
13
Src/Dlhis.Basic/Device/Request/DevicePageRequest.cs
Normal file
13
Src/Dlhis.Basic/Device/Request/DevicePageRequest.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Request;
|
||||
|
||||
public class DevicePageRequest : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 平台
|
||||
/// </summary>
|
||||
public string Brand { get; set; }
|
||||
|
||||
public string MyProperty { get; set; }
|
||||
}
|
||||
61
Src/Dlhis.Basic/Device/Request/DeviceSaveRequest.cs
Normal file
61
Src/Dlhis.Basic/Device/Request/DeviceSaveRequest.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
|
||||
namespace Dlhis.Basic.Device.Request;
|
||||
|
||||
public class DeviceSaveRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
|
||||
public string Sno { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// mac地址
|
||||
/// </summary>
|
||||
public string Mac { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板code
|
||||
/// </summary>
|
||||
public string TemplateCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 品牌
|
||||
/// </summary>
|
||||
public string Brand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供应商信息
|
||||
/// </summary>
|
||||
public string Supplier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备功能
|
||||
/// </summary>
|
||||
public List<DeviceFuncEnumType> Funcs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部署点
|
||||
/// </summary>
|
||||
public string DeployPlace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部署坐标
|
||||
/// </summary>
|
||||
public string DeployPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部署方向
|
||||
/// </summary>
|
||||
public string DeployDirection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 连接信息
|
||||
/// </summary>
|
||||
public string ConnectionInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool Enable { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Request;
|
||||
|
||||
public class DeviceTemplatePageRequest : PageDto
|
||||
{
|
||||
|
||||
}
|
||||
21
Src/Dlhis.Basic/Device/Request/DeviceTemplateSaveRequest.cs
Normal file
21
Src/Dlhis.Basic/Device/Request/DeviceTemplateSaveRequest.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace Dlhis.Basic.Device.Request;
|
||||
|
||||
public class DeviceTemplateSaveRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 品牌
|
||||
/// </summary>
|
||||
public string Brand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板json
|
||||
/// </summary>
|
||||
public string Template { get; set; }
|
||||
}
|
||||
5
Src/Dlhis.Basic/Device/Response/DeviceResponse.cs
Normal file
5
Src/Dlhis.Basic/Device/Response/DeviceResponse.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Dlhis.Basic.Device.Response;
|
||||
|
||||
public class DeviceResponse
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Dlhis.Basic.Device.Response;
|
||||
|
||||
public class DeviceTemplateResponse
|
||||
{
|
||||
|
||||
}
|
||||
12
Src/Dlhis.Basic/Device/Services/IDeviceService.cs
Normal file
12
Src/Dlhis.Basic/Device/Services/IDeviceService.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services;
|
||||
|
||||
public interface IDeviceService
|
||||
{
|
||||
Task<Pagination<DeviceResponse>> GetPageAsync(DevicePageRequest request);
|
||||
|
||||
Task SaveAsync(DeviceSaveRequest request);
|
||||
}
|
||||
11
Src/Dlhis.Basic/Device/Services/IDeviceTemplateService.cs
Normal file
11
Src/Dlhis.Basic/Device/Services/IDeviceTemplateService.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services;
|
||||
|
||||
public interface IDeviceTemplateService : IScopeDependency
|
||||
{
|
||||
Task SaveTemplateAsync(DeviceTemplateSaveRequest request);
|
||||
Task<Pagination<DeviceTemplateResponse>> GetPageAsync(DeviceTemplatePageRequest request);
|
||||
}
|
||||
49
Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs
Normal file
49
Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services.Implements;
|
||||
|
||||
public class DeviceService : IDeviceService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public DeviceService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<Pagination<DeviceResponse>> GetPageAsync(DevicePageRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<DeviceEntity>()
|
||||
.Select<DeviceResponse>()
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public async Task SaveAsync(DeviceSaveRequest request)
|
||||
{
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<DeviceEntity>();
|
||||
entity.Code = Guid.NewGuid();
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
var device = await _dbContext.Queryable<DeviceEntity>().Where(x => x.Id == request.Id).FirstAsync();
|
||||
device.ThrowIfNull("设备不存在,无法更新");
|
||||
|
||||
request.Adapt(device);
|
||||
|
||||
await _dbContext.UpdateAsync(device);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services.Implements;
|
||||
|
||||
public class DeviceTemplateService : IDeviceTemplateService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public DeviceTemplateService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
|
||||
public async Task<Pagination<DeviceTemplateResponse>> GetPageAsync(DeviceTemplatePageRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<DeviceTemplateEntity>()
|
||||
.Select<DeviceTemplateResponse>()
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
public async Task SaveTemplateAsync(DeviceTemplateSaveRequest request)
|
||||
{
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var entity = request.Adapt<DeviceTemplateEntity>();
|
||||
entity.Code = Guid.NewGuid();
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _dbContext.Queryable<DeviceTemplateEntity>().Where(x => x.Id == request.Id).FirstAsync();
|
||||
await ExistsDeviceUsingTemplateAsync(entity.Code);
|
||||
await _dbContext.UpdateAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//**********************************************************************************************************/
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 模板被引用,不能修改
|
||||
/// </summary>
|
||||
/// <param name="templateCode"></param>
|
||||
/// <returns></returns>
|
||||
private async Task ExistsDeviceUsingTemplateAsync(Guid templateCode)
|
||||
{
|
||||
var existsUsing = await _dbContext.Queryable<DeviceEntity>().Where(x => x.TemplateCode == templateCode).AnyAsync();
|
||||
existsUsing.ThrowIfTrue("存在使用中的设备信息,无法修改");
|
||||
}
|
||||
}
|
||||
26
Src/Dlhis.Basic/Dlhis.Basic.csproj
Normal file
26
Src/Dlhis.Basic/Dlhis.Basic.csproj
Normal file
@@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>disable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="log\**" />
|
||||
<Content Remove="log\**" />
|
||||
<EmbeddedResource Remove="log\**" />
|
||||
<None Remove="log\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.4.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
22
Src/Dlhis.Basic/Dockerfile
Normal file
22
Src/Dlhis.Basic/Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
||||
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["Dlhis.Basic/Dlhis.Basic.csproj", "Dlhis.Basic/"]
|
||||
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
||||
RUN dotnet restore "Dlhis.Basic/Dlhis.Basic.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/Dlhis.Basic"
|
||||
RUN dotnet build "Dlhis.Basic.csproj" -c Release -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "Dlhis.Basic.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "Dlhis.Basic.dll"]
|
||||
46
Src/Dlhis.Basic/MealUser/Controllers/MealUsersController.cs
Normal file
46
Src/Dlhis.Basic/MealUser/Controllers/MealUsersController.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Basic.MealUser.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 就餐人员
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class MealUsersController : ControllerBase
|
||||
{
|
||||
private readonly IMealUserService _mealUserService;
|
||||
|
||||
public MealUsersController(IMealUserService mealUserService)
|
||||
{
|
||||
_mealUserService = mealUserService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 就餐人员分页
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<MealUserResponse>> GetPageAsync([FromQuery] MealUserPageRequest request)
|
||||
{
|
||||
return await _mealUserService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 就餐人员保存
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task AddAsync(MealUserAddRequest request)
|
||||
{
|
||||
await _mealUserService.AddAsync(request);
|
||||
}
|
||||
}
|
||||
20
Src/Dlhis.Basic/MealUser/Request/MealUserAddRequest.cs
Normal file
20
Src/Dlhis.Basic/MealUser/Request/MealUserAddRequest.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Request;
|
||||
|
||||
public class MealUserAddRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 档案号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "档案号不能为空")]
|
||||
public string UserId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 用户类型
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(CanteenUserEnumType))]
|
||||
public CanteenUserEnumType UserType { get; set; }
|
||||
}
|
||||
7
Src/Dlhis.Basic/MealUser/Request/MealUserPageRequest.cs
Normal file
7
Src/Dlhis.Basic/MealUser/Request/MealUserPageRequest.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Request;
|
||||
|
||||
public class MealUserPageRequest : PageDto
|
||||
{
|
||||
}
|
||||
6
Src/Dlhis.Basic/MealUser/Response/MealUserResponse.cs
Normal file
6
Src/Dlhis.Basic/MealUser/Response/MealUserResponse.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Dlhis.Basic.MealUser.Response
|
||||
{
|
||||
public class MealUserResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
14
Src/Dlhis.Basic/MealUser/Services/IMealUserService.cs
Normal file
14
Src/Dlhis.Basic/MealUser/Services/IMealUserService.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Services;
|
||||
|
||||
public interface IMealUserService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<MealUserResponse>> GetPageAsync(MealUserPageRequest request);
|
||||
|
||||
Task AddAsync(MealUserAddRequest request);
|
||||
|
||||
Task<MealUserResponse> GetMealUserAsync(string uniqueId);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Services.Implements;
|
||||
|
||||
public class MealUserService : IMealUserService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public MealUserService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<Pagination<MealUserResponse>> GetPageAsync(MealUserPageRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<CanteenUserEntity>()
|
||||
.Select<MealUserResponse>()
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
public async Task AddAsync(MealUserAddRequest request)
|
||||
{
|
||||
//todo 获取档案信息
|
||||
|
||||
var entity = new CanteenUserEntity
|
||||
{
|
||||
UserId = request.UserId,
|
||||
UserType = request.UserType,
|
||||
UserCode = "",
|
||||
CarNo = "",
|
||||
Balance = 0,
|
||||
BalanceOfRecharge = 0,
|
||||
BalanceOfSubsidies = 0,
|
||||
Version = 0,
|
||||
};
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
|
||||
public async Task<MealUserResponse> GetMealUserAsync(string userId)
|
||||
{
|
||||
return await _dbContext.Queryable<CanteenUserEntity>()
|
||||
.Where(x => x.UserId == userId)
|
||||
.Select<MealUserResponse>()
|
||||
.FirstAsync();
|
||||
}
|
||||
}
|
||||
17
Src/Dlhis.Basic/Program.cs
Normal file
17
Src/Dlhis.Basic/Program.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Kurisu.Startup;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
KurisuHost.Run<Startup>(true, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class Startup : DefaultStartup
|
||||
{
|
||||
public Startup(IConfiguration configuration) : base(configuration)
|
||||
{
|
||||
}
|
||||
}
|
||||
15
Src/Dlhis.Basic/Properties/launchSettings.json
Normal file
15
Src/Dlhis.Basic/Properties/launchSettings.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"profiles": {
|
||||
"Dlhis.Basic": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"launchUrl": "swagger/index.html",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://localhost:5002"
|
||||
}
|
||||
},
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json"
|
||||
}
|
||||
25
Src/Dlhis.Basic/SqlSugarPack.cs
Normal file
25
Src/Dlhis.Basic/SqlSugarPack.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Kurisu.AspNetCore;
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Canteen;
|
||||
|
||||
public class SqlSugarPack : BaseAppPack
|
||||
{
|
||||
public override bool IsBeforeUseRouting { get; }
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddSqlSugar();
|
||||
}
|
||||
|
||||
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
//using var scope = app.ApplicationServices.CreateScope();
|
||||
//var db = scope.ServiceProvider.GetService<ISqlSugarClient>();
|
||||
//var tables = App.ActiveTyps.Where(x => x.IsDefined(typeof(SugarTable), false)).ToArray();
|
||||
//db.DbMaintenance.CreateDatabase();
|
||||
//db.CodeFirst.InitTables(tables);
|
||||
}
|
||||
}
|
||||
8
Src/Dlhis.Basic/appsettings.Development.json
Normal file
8
Src/Dlhis.Basic/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
74
Src/Dlhis.Basic/appsettings.json
Normal file
74
Src/Dlhis.Basic/appsettings.json
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"InternalRequest": {
|
||||
"CommonRequestUrl": "http://common"
|
||||
},
|
||||
"SqlSugarOptions": {
|
||||
"DefaultConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=yikatong;charset=utf8mb4;",
|
||||
"SlaveConnectionString": [],
|
||||
"Timeout": 30,
|
||||
"SlowSqlTime": 1,
|
||||
"EnableSqlLog": true
|
||||
},
|
||||
"SwaggerOptions": {
|
||||
"Enable": true,
|
||||
"Authority": "https://yikatong.isawesome.cn/oauth2",
|
||||
"ClientId": "4fb184324eac4180",
|
||||
"ClientSecret": "8ac8f235152f1524",
|
||||
"Scopes": {
|
||||
"openid": "openid",
|
||||
"profile": "profile",
|
||||
"yikatong": "yikatong"
|
||||
}
|
||||
},
|
||||
"IdentityServerOptions": {
|
||||
"Authority": "https://yikatong.isawesome.cn/oauth2",
|
||||
"RequireHttpsMetadata": true,
|
||||
"Issuer": "identity.isawesome.cn",
|
||||
"Audience": "",
|
||||
"Pat": {
|
||||
"Enable": false,
|
||||
"Scheme": "token",
|
||||
"ClientId": "reference",
|
||||
"ClientSecret": "123456"
|
||||
}
|
||||
},
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
"Override": {
|
||||
"System": "Warning",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "Async",
|
||||
"Args": {
|
||||
"configure": [
|
||||
{
|
||||
"Name": "Console",
|
||||
"Args": {
|
||||
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "log/log.txt",
|
||||
"rollingInterval": "Hour"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user