From 0bcb6501c41921d0a8d6f360fc5e7560d8cf78af Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Mon, 15 Apr 2024 12:28:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=86=85=E5=B5=8C=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=A1=B9=E7=9B=AE=E5=92=8C=E8=B4=A7=E7=89=A9=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/EmbedServiceProjectDto.cs | 24 +++ .../EmbedProjectGoodsStatusService.cs | 175 ++++++++++++++++++ .../IEmbedProjectGoodsStatusService.cs | 54 ++++++ 3 files changed, 253 insertions(+) create mode 100644 Myshipping.Application/Service/EmbedProjectGoodsStatus/Dtos/EmbedServiceProjectDto.cs create mode 100644 Myshipping.Application/Service/EmbedProjectGoodsStatus/EmbedProjectGoodsStatusService.cs create mode 100644 Myshipping.Application/Service/EmbedProjectGoodsStatus/Interface/IEmbedProjectGoodsStatusService.cs diff --git a/Myshipping.Application/Service/EmbedProjectGoodsStatus/Dtos/EmbedServiceProjectDto.cs b/Myshipping.Application/Service/EmbedProjectGoodsStatus/Dtos/EmbedServiceProjectDto.cs new file mode 100644 index 00000000..3a3f5284 --- /dev/null +++ b/Myshipping.Application/Service/EmbedProjectGoodsStatus/Dtos/EmbedServiceProjectDto.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 内嵌服务项目请求 + /// + public class EmbedServiceProjectDto + { + /// + /// 业务主键 + /// + public string businessId { get; set; } + + /// + /// 服务项目代码 + /// + public string[] ProjectCodes { get; set; } + } +} diff --git a/Myshipping.Application/Service/EmbedProjectGoodsStatus/EmbedProjectGoodsStatusService.cs b/Myshipping.Application/Service/EmbedProjectGoodsStatus/EmbedProjectGoodsStatusService.cs new file mode 100644 index 00000000..606cdcf3 --- /dev/null +++ b/Myshipping.Application/Service/EmbedProjectGoodsStatus/EmbedProjectGoodsStatusService.cs @@ -0,0 +1,175 @@ +using Furion.DependencyInjection; +using Furion.DistributedIDGenerator; +using Furion.DynamicApiController; +using Furion.FriendlyException; +using Furion.JsonSerialization; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using StackExchange.Profiling.Internal; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 内嵌服务项目和货物状态 + /// + + [AllowAnonymous, ApiDescriptionSettings("Application", Name = "EmbedProjectGoodsStatus", Order = 20)] + public class EmbedProjectGoodsStatusService: IEmbedProjectGoodsStatusService, IDynamicApiController, ITransient + { + private readonly ILogger _logger; + + /// + /// + /// + /// + public EmbedProjectGoodsStatusService(ILogger logger) + { + _logger = logger; + } + + + /// + /// 保存服务项目 + /// + /// 修改服务项目详情 + /// 返回回执 + [HttpPost("/EmbedProjectGoodsStatus/SaveServiceProject")] + public async Task SaveServiceProject(EmbedServiceProjectDto model) + { + TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + + string batchNo = IDGen.NextID().ToString(); + + try + { + if (string.IsNullOrWhiteSpace(model.businessId)) + throw Oops.Oh($"业务主键不能为空"); + + _logger.LogInformation("批次={no} 请求保存服务项目 modifyjson={msg}", batchNo, JSON.Serialize(model)); + + TrackingMessageInfo msgInfo = new TrackingMessageInfo + { + Head = new TrackingMessageHeadInfo + { + GID = IDGen.NextID().ToString(), + MessageType = "PROJECT", + ReceiverId = "ServiceProjectStatus", + ReceiverName = "服务项目和状态", + SenderId = "BookingOrder", + SenderName = "海运订舱", + RequestDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), + Version = "2.0", + RequestAction = "AddOrModify", + }, + Main = new TrackingMessageMainInfo + { + BusiId = model.businessId, + BusiSystemCode = "BOOKING_ORDER", + MBlNo = "", + VesselVoyno = "", + OrderNo = "", + PushType = TrackingPushTypeEnum.Project, + OperTenantId = 0, + OperTenantName = "", + OpertType = TrackingOperTypeEnum.MANUAL, + OperUserId = "", + OperUserName = "", + SourceType = TrackingSourceTypeEnum.MANUAL, + ProjectList = model.ProjectCodes.Select(a => new TrackingMessageMainProjectInfo + { + ServiceProjectCode = a, + }).ToList() + } + }; + + DateTime bDate = DateTime.Now; + + _logger.LogInformation("批次={no} 推送保存服务项目 msg={msg}", batchNo, JSON.Serialize(msgInfo)); + + //var rlt = await _serviceWorkFlowManageService.PushStatus(msgInfo); + + //DateTime eDate = DateTime.Now; + //TimeSpan ts = eDate.Subtract(bDate); + //var timeDiff = ts.TotalMilliseconds; + + //_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg} result={rlt}", batchNo, timeDiff, (rlt.succ ? "成功" : "失败") + // , JSON.Serialize(rlt)); + + //if (!rlt.succ) + //{ + // result = rlt; + //} + //else + //{ + // result.succ = true; + // result.msg = "保存成功"; + //} + + } + catch (Exception ex) + { + result.succ = false; + result.msg = $"服务项目保存失败,原因:{ex.Message}"; + } + + return result; + } + + /// + /// 取消服务项目 + /// + /// 修改服务项目详情 + /// 返回回执 + public async Task CancelServiceProject(ModifyServiceProjectDto model) + { + return null; + } + + /// + /// 获取服务项目列表 + /// + /// 查询服务项目和状态详情 + /// 返回回执 + public async Task GetServiceProjectList(QueryServiceProjectWithStatus model) + { + return null; + } + + + /// + /// 获取服务项目下的状态列表 + /// + /// 查询服务项目和状态详情 + /// 返回回执 + public async Task GetServiceStatusList(QueryServiceProjectWithStatus model) + { + return null; + } + + /// + /// 保存服务状态 + /// + /// 修改服务状态详情 + /// 返回回执 + public async Task SaveServiceStatus(ModifyServiceProjectStatusDto model) + { + return null; + } + + /// + /// 取消服务状态 + /// + /// 修改服务状态详情 + /// 返回回执 + public async Task CancelServiceStatus(ModifyServiceProjectStatusDto model) + { + return null; + } + } +} diff --git a/Myshipping.Application/Service/EmbedProjectGoodsStatus/Interface/IEmbedProjectGoodsStatusService.cs b/Myshipping.Application/Service/EmbedProjectGoodsStatus/Interface/IEmbedProjectGoodsStatusService.cs new file mode 100644 index 00000000..9b2ca01e --- /dev/null +++ b/Myshipping.Application/Service/EmbedProjectGoodsStatus/Interface/IEmbedProjectGoodsStatusService.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + public interface IEmbedProjectGoodsStatusService + { + /// + /// 保存服务项目 + /// + /// 修改服务项目详情 + /// 返回回执 + Task SaveServiceProject(EmbedServiceProjectDto model); + + /// + /// 取消服务项目 + /// + /// 修改服务项目详情 + /// 返回回执 + Task CancelServiceProject(ModifyServiceProjectDto model); + + /// + /// 获取服务项目列表 + /// + /// 查询服务项目和状态详情 + /// 返回回执 + Task GetServiceProjectList(QueryServiceProjectWithStatus model); + + + /// + /// 获取服务项目下的状态列表 + /// + /// 查询服务项目和状态详情 + /// 返回回执 + Task GetServiceStatusList(QueryServiceProjectWithStatus model); + + /// + /// 保存服务状态 + /// + /// 修改服务状态详情 + /// 返回回执 + Task SaveServiceStatus(ModifyServiceProjectStatusDto model); + + /// + /// 取消服务状态 + /// + /// 修改服务状态详情 + /// 返回回执 + Task CancelServiceStatus(ModifyServiceProjectStatusDto model); + } +}