|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
using Furion;
|
|
|
|
|
using Furion.EventBus;
|
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
|
using Furion.RemoteRequest.Extensions;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
@ -8,6 +10,8 @@ using Myshipping.Application.Entity;
|
|
|
|
|
using Myshipping.Application.Service.BookingOrder.Dto;
|
|
|
|
|
using Myshipping.Core;
|
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
@ -48,6 +52,8 @@ namespace Myshipping.Application.Event
|
|
|
|
|
var repoGoodsSta = scope.ServiceProvider.GetRequiredService<SqlSugarRepository<BookingGoodsStatus>>();
|
|
|
|
|
var repoGoodsStaCfg = scope.ServiceProvider.GetRequiredService<SqlSugarRepository<BookingGoodsStatusConfig>>();
|
|
|
|
|
|
|
|
|
|
var cacheService = scope.ServiceProvider.GetRequiredService<ISysCacheService>();
|
|
|
|
|
|
|
|
|
|
var custOrder = await repoCutomerOrder.AsQueryable().Filter(null, true).FirstAsync(x => x.BookingId == bookId);
|
|
|
|
|
if (custOrder == null) //非客户订舱系统过来的数据
|
|
|
|
|
{
|
|
|
|
@ -105,7 +111,50 @@ namespace Myshipping.Application.Event
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"准备发送客户订舱数据同步:{sendObj.ToJsonString()}");
|
|
|
|
|
//回推回执
|
|
|
|
|
var recFeedbackConfig = cacheService.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "DjyBookingCustomerRecFeedbackURL");
|
|
|
|
|
if (recFeedbackConfig == null || string.IsNullOrEmpty(recFeedbackConfig.Value))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("回推订舱数据的URL地址未配置,请联系管理员");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var recFeedbackUserKey = cacheService.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "DjyBookingCustomerRecFeedbackUserKey");
|
|
|
|
|
if (recFeedbackUserKey == null || string.IsNullOrEmpty(recFeedbackUserKey.Value))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("回推订舱数据的用户KEY未配置,请联系管理员");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var recFeedbackUserSecret = cacheService.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "DjyBookingCustomerRecFeedbackUserSecret");
|
|
|
|
|
if (recFeedbackUserSecret == null || string.IsNullOrEmpty(recFeedbackUserSecret.Value))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("回推订舱数据的用户秘钥未配置,请联系管理员");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var feedbackUrl = recFeedbackConfig.Value;
|
|
|
|
|
if (!feedbackUrl.EndsWith("/"))
|
|
|
|
|
{
|
|
|
|
|
feedbackUrl += "/";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
feedbackUrl += "BookingCustomerOrder/RecBookingDataFeedback";
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"准备发送客户订舱数据同步:{sendObj.ToJsonString()},URL:{feedbackUrl}");
|
|
|
|
|
|
|
|
|
|
var rtn = await feedbackUrl
|
|
|
|
|
.SetHeaders(new Dictionary<string, object> {
|
|
|
|
|
{ CommonConst.API_USER_HEADER_KEY, recFeedbackUserKey.Value},
|
|
|
|
|
{ CommonConst.API_USER_HEADER_SECRET, recFeedbackUserSecret.Value}
|
|
|
|
|
})
|
|
|
|
|
.SetBody(sendObj)
|
|
|
|
|
.PostAsStringAsync();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"回推审核返回:{rtn}");
|
|
|
|
|
|
|
|
|
|
var jobjRtn = JObject.Parse(rtn);
|
|
|
|
|
if (jobjRtn.GetIntValue("code") != 200)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(jobjRtn.GetStringValue("message"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|