|
|
@ -11881,11 +11881,92 @@ namespace Myshipping.Application
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if(string.IsNullOrWhiteSpace(model.collectionOriginCityName))
|
|
|
|
|
|
|
|
throw Oops.Oh($"始发地不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(model.deliveryDestinationCityName))
|
|
|
|
|
|
|
|
throw Oops.Oh($"目的地不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(model.vesselOperatorCarrierCode))
|
|
|
|
|
|
|
|
throw Oops.Oh($"服务船公司不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(model.startDate))
|
|
|
|
|
|
|
|
throw Oops.Oh($"预计离港日期不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DateTime etd = DateTime.MinValue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!DateTime.TryParse(model.startDate,out etd))
|
|
|
|
|
|
|
|
throw Oops.Oh($"预计离港日期格式错误");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string queryUrl = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.carrierId.Equals("MSK", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
queryUrl = _cache.GetAllDictData().GetAwaiter().GetResult()
|
|
|
|
|
|
|
|
.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == CONST_MSK_API_Poing2P_SECD_URL)?.Value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Oh($"当前船公司 {model.carrierId} 未配置相应的请求接口");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(queryUrl))
|
|
|
|
|
|
|
|
throw Oops.Oh("未配置查询船期请求接口地址,请联系管理员");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var webAccountConfig = _webAccountConfig
|
|
|
|
|
|
|
|
.GetAccountConfig("MSKApi", UserManager.UserId).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (webAccountConfig == null)
|
|
|
|
|
|
|
|
throw Oops.Oh("未配置个人账户,请先配置个人账户 类型-MSKApi");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MSKAPISearchPoint2PointScheduleDto queryInfo = new MSKAPISearchPoint2PointScheduleDto
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
userKey = App.Configuration["MSKAPIDjyUserKey"],
|
|
|
|
|
|
|
|
userSecret = App.Configuration["MSKAPIDjyUserSecret"],
|
|
|
|
|
|
|
|
operatingEnvironment = App.Configuration["MSKAPIOPEnvironment"],
|
|
|
|
|
|
|
|
mskAppKey = webAccountConfig.Account,
|
|
|
|
|
|
|
|
collectionOriginCityName = model.collectionOriginCityName,
|
|
|
|
|
|
|
|
collectionOriginCountryCode = model.collectionOriginCountryCode,
|
|
|
|
|
|
|
|
deliveryDestinationCityName = model.deliveryDestinationCityName,
|
|
|
|
|
|
|
|
deliveryDestinationCountryCode = model.deliveryDestinationCountryCode,
|
|
|
|
|
|
|
|
cargoType = model.cargoType,
|
|
|
|
|
|
|
|
exportServiceMode = model.exportServiceMode,
|
|
|
|
|
|
|
|
importServiceMode = model.importServiceMode,
|
|
|
|
|
|
|
|
vesselOperatorCarrierCode = model.vesselOperatorCarrierCode,
|
|
|
|
|
|
|
|
startDate = etd.ToString("yyyy-MM-dd"),
|
|
|
|
|
|
|
|
startDateType = "D",
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MSKAPISearchPoint2PointScheduleResultDto resultInfo = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var rlt = await queryUrl.SetBody(queryInfo)
|
|
|
|
|
|
|
|
.PostAsStringAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(rlt))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
resultInfo = JSON.Deserialize<MSKAPISearchPoint2PointScheduleResultDto>(rlt);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation($"请求MSK API查询船期异常,原因:{ex.Message}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah($"请求MSK API查询船期异常,原因:{ex.Message}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (resultInfo != null && resultInfo.code == 200
|
|
|
|
|
|
|
|
&& resultInfo.data != null && resultInfo.data.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
list = resultInfo.data.Adapt<List<SearchShipSailingScheduleResultDto>>();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogError($"检索海运船期详情异常,req={JSON.Serialize(model)} 原因:{ex.Message}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah($"检索海运船期详情失败,{ex.Message}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
return list;
|
|
|
|