You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
BookingHeChuan/Myshipping.Application/Service/EmbedProjectGoodsStatus/EmbedProjectGoodsStatusServ...

176 lines
6.2 KiB
C#

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
{
/// <summary>
/// 内嵌服务项目和货物状态
/// </summary>
[AllowAnonymous, ApiDescriptionSettings("Application", Name = "EmbedProjectGoodsStatus", Order = 20)]
public class EmbedProjectGoodsStatusService: IEmbedProjectGoodsStatusService, IDynamicApiController, ITransient
{
private readonly ILogger<BookingTruckService> _logger;
/// <summary>
///
/// </summary>
/// <param name="logger"></param>
public EmbedProjectGoodsStatusService(ILogger<BookingTruckService> logger)
{
_logger = logger;
}
/// <summary>
/// 保存服务项目
/// </summary>
/// <param name="model">修改服务项目详情</param>
/// <returns>返回回执</returns>
[HttpPost("/EmbedProjectGoodsStatus/SaveServiceProject")]
public async Task<TaskManageOrderResultDto> 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;
}
/// <summary>
/// 取消服务项目
/// </summary>
/// <param name="model">修改服务项目详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> CancelServiceProject(ModifyServiceProjectDto model)
{
return null;
}
/// <summary>
/// 获取服务项目列表
/// </summary>
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetServiceProjectList(QueryServiceProjectWithStatus model)
{
return null;
}
/// <summary>
/// 获取服务项目下的状态列表
/// </summary>
/// <param name="model">查询服务项目和状态详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetServiceStatusList(QueryServiceProjectWithStatus model)
{
return null;
}
/// <summary>
/// 保存服务状态
/// </summary>
/// <param name="model">修改服务状态详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> SaveServiceStatus(ModifyServiceProjectStatusDto model)
{
return null;
}
/// <summary>
/// 取消服务状态
/// </summary>
/// <param name="model">修改服务状态详情</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> CancelServiceStatus(ModifyServiceProjectStatusDto model)
{
return null;
}
}
}