From 1fea7bb844864075a16bbb56860fa2de47056d1e Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 15 Nov 2022 17:14:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E8=88=B1=E5=85=B3=E7=B3=BB=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Myshipping.Application.xml | 266 +++++++++++++++++- .../BookingOrder/BookingOrderService.cs | 2 +- .../BookingOrderContactService.cs | 133 +++++++++ .../Dto/BookingOrderContactDto.cs | 57 ++++ .../Dto/BookingOrderContactInput.cs | 136 +++++++++ .../Dto/BookingOrderContactOutput.cs | 52 ++++ .../IBookingOrderContactService.cs | 16 ++ Myshipping.Core/Myshipping.Core.xml | 7 + .../Service/DjyCustomer/DjyCustomerService.cs | 15 + .../DjyCustomer/IDjyCustomerService.cs | 3 + 10 files changed, 685 insertions(+), 2 deletions(-) create mode 100644 Myshipping.Application/Service/BookingOrderContact/BookingOrderContactService.cs create mode 100644 Myshipping.Application/Service/BookingOrderContact/Dto/BookingOrderContactDto.cs create mode 100644 Myshipping.Application/Service/BookingOrderContact/Dto/BookingOrderContactInput.cs create mode 100644 Myshipping.Application/Service/BookingOrderContact/Dto/BookingOrderContactOutput.cs create mode 100644 Myshipping.Application/Service/BookingOrderContact/IBookingOrderContactService.cs diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index 356bbc77..62252de0 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -6571,6 +6571,270 @@ 备注 + + + 订舱关系人服务 + + + + + 分页查询订舱关系人 + + + + + + + 增加订舱关系人 + + + + + + + 更新订舱关系人 + + + + + + + 删除订舱关系人 + + + + + + + 获取订舱关系人 + + + + + + + 根据订舱ID获取关系人 + + + + + + + 批量保存关系人(同时新增、删除、修改) + + + + + + + 订舱关系人输出参数 + + + + + 主键 + + + + + 订舱Id + + + + + 角色代码 + + + + + 名称 + + + + + 电话 + + + + + 邮箱 + + + + + 排序号 + + + + + 备注 + + + + + 租户ID + + + + + 订舱关系人输入参数 + + + + + 订舱Id + + + + + 角色代码 + + + + + 名称 + + + + + 电话 + + + + + 邮箱 + + + + + 排序号 + + + + + 备注 + + + + + 订舱关系人新增输入参数 + + + + + 订舱关系人修改输入参数 + + + + + 主键 + + + + + 订舱关系人获取(删除)输入参数 + + + + + 主键 + + + + + 订舱关系人查询输入参数 + + + + + 主键 + + + + + 订舱Id + + + + + 角色代码 + + + + + 名称 + + + + + 电话 + + + + + 邮箱 + + + + + 排序号 + + + + + 备注 + + + + + 租户ID + + + + + 订舱关系人输出参数 + + + + + 主键 + + + + + 订舱Id + + + + + 角色代码 + + + + + 名称 + + + + + 电话 + + + + + 邮箱 + + + + + 排序号 + + + + + 备注 + + 订舱服务 @@ -6680,7 +6944,7 @@ 放舱发送 - + diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 33f49d78..27d750f2 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -731,7 +731,7 @@ namespace Myshipping.Application /// /// 放舱发送 /// - /// + /// /// [HttpPost("/BookingLetteryard/sendletteryard")] public async Task SendLetterYard(long bookingId) diff --git a/Myshipping.Application/Service/BookingOrderContact/BookingOrderContactService.cs b/Myshipping.Application/Service/BookingOrderContact/BookingOrderContactService.cs new file mode 100644 index 00000000..8b03ea43 --- /dev/null +++ b/Myshipping.Application/Service/BookingOrderContact/BookingOrderContactService.cs @@ -0,0 +1,133 @@ +using Myshipping.Core; +using Furion.DependencyInjection; +using Furion.DynamicApiController; +using Mapster; +using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using System.Linq; +using System.Threading.Tasks; +using Myshipping.Application.Entity; +using Microsoft.Extensions.Logging; +using System.Collections.Generic; + +namespace Myshipping.Application +{ + /// + /// 订舱关系人服务 + /// + [ApiDescriptionSettings("Application", Name = "BookingOrderContact", Order = 1)] + public class BookingOrderContactService : IBookingOrderContactService, IDynamicApiController, ITransient + { + private readonly SqlSugarRepository _rep; + private readonly ILogger _logger; + + public BookingOrderContactService(SqlSugarRepository rep, ILogger logger) + { + _rep = rep; + _logger = logger; + } + + /// + /// 分页查询订舱关系人 + /// + /// + /// + [HttpGet("/BookingOrderContact/page")] + public async Task Page([FromQuery] QueryBookingOrderContactInput input) + { + var entities = await _rep.AsQueryable() + .WhereIF(!string.IsNullOrWhiteSpace(input.RoleCode), u => u.RoleCode.Contains(input.RoleCode.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Tel), u => u.Tel.Contains(input.Tel.Trim())) + .WhereIF(!string.IsNullOrWhiteSpace(input.Email), u => u.Email.Contains(input.Email.Trim())) + .ToPagedListAsync(input.PageNo, input.PageSize); + return entities.XnPagedResult(); + } + + /// + /// 增加订舱关系人 + /// + /// + /// + [HttpPost("/BookingOrderContact/add")] + public async Task Add(AddBookingOrderContactInput input) + { + var entity = input.Adapt(); + await _rep.InsertAsync(entity); + } + + /// + /// 更新订舱关系人 + /// + /// + /// + [HttpPost("/BookingOrderContact/edit")] + public async Task Update(UpdateBookingOrderContactInput input) + { + var entity = input.Adapt(); + await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } + + /// + /// 删除订舱关系人 + /// + /// + /// + [HttpPost("/BookingOrderContact/delete")] + public async Task Delete(GetBookingOrderContactInput input) + { + var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id); + await _rep.DeleteAsync(entity); + } + + /// + /// 获取订舱关系人 + /// + /// + /// + [HttpGet("/BookingOrderContact/detail")] + public async Task Get([FromQuery] GetBookingOrderContactInput input) + { + return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id); + } + + /// + /// 根据订舱ID获取关系人 + /// + /// + /// + [HttpGet("/BookingOrderContact/listbyorder")] + public async Task> ListByOrder(long bookingId) + { + var list = await _rep.Where(x => x.BookingId == bookingId).ToListAsync(); + return list.Adapt>(); + } + + /// + /// 批量保存关系人(同时新增、删除、修改) + /// + /// + /// + [HttpPost("/BookingOrderContact/savebatch"), SqlSugarUnitOfWork] + public async Task SaveBatch(List input) + { + var bookingId = input.First().BookingId; + _rep.Delete(x => x.BookingId == bookingId); + foreach (var item in input) + { + await _rep.InsertAsync(item.Adapt()); + } + } + + ///// + ///// 获取订舱关系人列表 + ///// + ///// + ///// + //[HttpGet("/BookingOrderContact/list")] + //public async Task List([FromQuery] QueryBookingOrderContactInput input) + //{ + // return await _rep.ToListAsync(); + //} + } +} diff --git a/Myshipping.Application/Service/BookingOrderContact/Dto/BookingOrderContactDto.cs b/Myshipping.Application/Service/BookingOrderContact/Dto/BookingOrderContactDto.cs new file mode 100644 index 00000000..67c9a616 --- /dev/null +++ b/Myshipping.Application/Service/BookingOrderContact/Dto/BookingOrderContactDto.cs @@ -0,0 +1,57 @@ +using System; +using Myshipping.Core; + +namespace Myshipping.Application +{ + /// + /// 订舱关系人输出参数 + /// + public class BookingOrderContactDto + { + /// + /// 主键 + /// + public long? Id { get; set; } + + /// + /// 订舱Id + /// + public long? BookingId { get; set; } + + /// + /// 角色代码 + /// + public string RoleCode { get; set; } + + /// + /// 名称 + /// + public string Name { get; set; } + + /// + /// 电话 + /// + public string Tel { get; set; } + + /// + /// 邮箱 + /// + public string Email { get; set; } + + /// + /// 排序号 + /// + public int? Sort { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + + /// + /// 租户ID + /// + public long? TenantId { get; set; } + + } +} diff --git a/Myshipping.Application/Service/BookingOrderContact/Dto/BookingOrderContactInput.cs b/Myshipping.Application/Service/BookingOrderContact/Dto/BookingOrderContactInput.cs new file mode 100644 index 00000000..b2132d13 --- /dev/null +++ b/Myshipping.Application/Service/BookingOrderContact/Dto/BookingOrderContactInput.cs @@ -0,0 +1,136 @@ +using Myshipping.Core; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Myshipping.Application +{ + /// + /// 订舱关系人输入参数 + /// + public class BookingOrderContactInput + { + /// + /// 订舱Id + /// + public virtual long BookingId { get; set; } + + /// + /// 角色代码 + /// + public virtual string RoleCode { get; set; } + + /// + /// 名称 + /// + public virtual string Name { get; set; } + + /// + /// 电话 + /// + public virtual string Tel { get; set; } + + /// + /// 邮箱 + /// + public virtual string Email { get; set; } + + /// + /// 排序号 + /// + public virtual int Sort { get; set; } + + /// + /// 备注 + /// + public virtual string Remark { get; set; } + + } + + /// + /// 订舱关系人新增输入参数 + /// + public class AddBookingOrderContactInput : BookingOrderContactInput + { + } + + /// + /// 订舱关系人修改输入参数 + /// + public class UpdateBookingOrderContactInput : BookingOrderContactInput + { + /// + /// 主键 + /// + [Required(ErrorMessage = "主键不能为空")] + public long Id { get; set; } + + } + + /// + /// 订舱关系人获取(删除)输入参数 + /// + public class GetBookingOrderContactInput + { + /// + /// 主键 + /// + [Required(ErrorMessage = "主键不能为空")] + public long Id { get; set; } + + } + + /// + /// 订舱关系人查询输入参数 + /// + public class QueryBookingOrderContactInput : PageInputBase + { + /// + /// 主键 + /// + public virtual long Id { get; set; } + + /// + /// 订舱Id + /// + public virtual long BookingId { get; set; } + + /// + /// 角色代码 + /// + public virtual string RoleCode { get; set; } + + /// + /// 名称 + /// + public virtual string Name { get; set; } + + /// + /// 电话 + /// + public virtual string Tel { get; set; } + + /// + /// 邮箱 + /// + public virtual string Email { get; set; } + + /// + /// 排序号 + /// + public virtual int Sort { get; set; } + + /// + /// 备注 + /// + public virtual string Remark { get; set; } + + /// + /// 租户ID + /// + public virtual long TenantId { get; set; } + + } + + +} diff --git a/Myshipping.Application/Service/BookingOrderContact/Dto/BookingOrderContactOutput.cs b/Myshipping.Application/Service/BookingOrderContact/Dto/BookingOrderContactOutput.cs new file mode 100644 index 00000000..7691703f --- /dev/null +++ b/Myshipping.Application/Service/BookingOrderContact/Dto/BookingOrderContactOutput.cs @@ -0,0 +1,52 @@ +using System; + +namespace Myshipping.Application +{ + /// + /// 订舱关系人输出参数 + /// + public class BookingOrderContactOutput + { + /// + /// 主键 + /// + public long Id { get; set; } + + /// + /// 订舱Id + /// + public long BookingId { get; set; } + + /// + /// 角色代码 + /// + public string RoleCode { get; set; } + + /// + /// 名称 + /// + public string Name { get; set; } + + /// + /// 电话 + /// + public string Tel { get; set; } + + /// + /// 邮箱 + /// + public string Email { get; set; } + + /// + /// 排序号 + /// + public int Sort { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + + + } +} diff --git a/Myshipping.Application/Service/BookingOrderContact/IBookingOrderContactService.cs b/Myshipping.Application/Service/BookingOrderContact/IBookingOrderContactService.cs new file mode 100644 index 00000000..09132d01 --- /dev/null +++ b/Myshipping.Application/Service/BookingOrderContact/IBookingOrderContactService.cs @@ -0,0 +1,16 @@ +using Myshipping.Core; +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Myshipping.Application.Entity; +namespace Myshipping.Application +{ + public interface IBookingOrderContactService + { + Task Page([FromQuery] QueryBookingOrderContactInput input); + Task Add(AddBookingOrderContactInput input); + Task Update(UpdateBookingOrderContactInput input); + Task Delete(GetBookingOrderContactInput input); + Task Get([FromQuery] GetBookingOrderContactInput input); + //Task List([FromQuery] QueryBookingOrderContactInput input); + } +} \ No newline at end of file diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index f21d276f..ed24d42d 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -8285,6 +8285,13 @@ + + + 根据客户id,获取所有联系人 + + + + 订舱客户联系人输出参数 diff --git a/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs b/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs index 20a2b9ae..fefad3b9 100644 --- a/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs +++ b/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs @@ -144,6 +144,18 @@ namespace Myshipping.Core.Service return custOut; } + /// + /// 根据客户id,获取所有联系人 + /// + /// + /// + [HttpGet("/DjyCustomer/contacts")] + public async Task> ListContact(long customerId) + { + var list = await _repContact.Where(x => x.CustomerId == customerId).OrderBy(x => x.Sort).ToListAsync(); + return list.Adapt>(); + } + ///// ///// 获取客户列表 ///// @@ -154,5 +166,8 @@ namespace Myshipping.Core.Service //{ // return await _rep.ToListAsync(); //} + + + } } diff --git a/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs b/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs index 2197e47b..cdd0d494 100644 --- a/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs +++ b/Myshipping.Core/Service/DjyCustomer/IDjyCustomerService.cs @@ -2,6 +2,8 @@ using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; using Myshipping.Core.Entity; +using System.Collections.Generic; + namespace Myshipping.Core.Service { public interface IDjyCustomerService @@ -12,5 +14,6 @@ namespace Myshipping.Core.Service Task Delete(GetDjyCustomerInput input); Task Detail([FromQuery] GetDjyCustomerInput input); //Task List([FromQuery] QueryBookingCustomerInput input); + Task> ListContact(long customerId); } }