|
|
@ -10,6 +10,9 @@ using Myshipping.Application.Entity;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
using Myshipping.Application.Enum;
|
|
|
|
using Myshipping.Application.Enum;
|
|
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using Myshipping.Application.Service.BookingTemplate.Dto;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application
|
|
|
|
namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -20,10 +23,16 @@ namespace Myshipping.Application
|
|
|
|
public class BookingTemplateService : IBookingTemplateService, IDynamicApiController, ITransient
|
|
|
|
public class BookingTemplateService : IBookingTemplateService, IDynamicApiController, ITransient
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly SqlSugarRepository<BookingTemplate> _rep;
|
|
|
|
private readonly SqlSugarRepository<BookingTemplate> _rep;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<BookingOrder> _repOrder;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<BookingExcelTemplate> _excelrep;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<BookingExcelTemplateSub> _excelsubrep;
|
|
|
|
private readonly ILogger<BookingTemplate> _logger;
|
|
|
|
private readonly ILogger<BookingTemplate> _logger;
|
|
|
|
|
|
|
|
|
|
|
|
public BookingTemplateService(SqlSugarRepository<BookingTemplate> rep, ILogger<BookingTemplate> logger)
|
|
|
|
public BookingTemplateService(SqlSugarRepository<BookingTemplate> rep, SqlSugarRepository<BookingOrder> repOrder, SqlSugarRepository<BookingExcelTemplate> excelrep, SqlSugarRepository<BookingExcelTemplateSub> excelsubrep, ILogger<BookingTemplate> logger)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
_excelrep = excelrep;
|
|
|
|
|
|
|
|
_excelsubrep = excelsubrep;
|
|
|
|
|
|
|
|
_repOrder = repOrder;
|
|
|
|
_rep = rep;
|
|
|
|
_rep = rep;
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -103,16 +112,64 @@ namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 下拉获取字段名称
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpGet("/BookingTemplate/GetFieldName")]
|
|
|
|
|
|
|
|
public async Task<dynamic> GetFieldName()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BookingOrder order = new BookingOrder();
|
|
|
|
|
|
|
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(order))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
string name = descriptor.Name;
|
|
|
|
|
|
|
|
if (name == "TenantId" || name == "CreatedTime" || name == "UpdatedTime" || name == "CreatedUserId" || name == "CreatedUserName")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(descriptor.Description))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dic.Add(descriptor.Name, descriptor.Description);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return dic;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 新增编辑excel模板
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="dto"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpGet("/BookingTemplate/GetFieldName")]
|
|
|
|
|
|
|
|
public async Task<dynamic> AddOrUpdateExcelTemplate(BookingExcelTemplateDto dto) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dto.Id == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BookingExcelTemplate bookingExcel = new BookingExcelTemplate();
|
|
|
|
|
|
|
|
bookingExcel.Name = dto.Name;
|
|
|
|
|
|
|
|
bookingExcel.Type = dto.Type;
|
|
|
|
|
|
|
|
await _excelrep.InsertAsync(bookingExcel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
|
|
|
|
|
///// 获取订舱模板列表
|
|
|
|
|
|
|
|
///// </summary>
|
|
|
|
|
|
|
|
///// <param name="input"></param>
|
|
|
|
|
|
|
|
///// <returns></returns>
|
|
|
|
|
|
|
|
//[HttpGet("/BookingTemplate/list")]
|
|
|
|
|
|
|
|
//public async Task<dynamic> List([FromQuery] QueryBookingTemplateInput input)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// return await _rep.ToListAsync();
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|