引入场站信息接口返回联系人信息

master
zhangxiaofeng 8 months ago
parent a45e2373d3
commit 756b8c8b0b

@ -29,7 +29,7 @@ namespace Myshipping.Application.Helper
/// <param name="yardid">场站ID</param>
/// <param name="isWeb">是否网站</param>
/// <returns>返回场站详情(按箱明细显示)</returns>
public static async Task<KeyValuePair<bool, string>> GetYardData(long userId, long tenantId, string tenantName, string mblno, string yardid, bool isWeb = true)
public static async Task<(bool isSuccess, string data, string contact)> GetYardData(long userId, long tenantId, string tenantName, string mblno, string yardid, bool isWeb = true)
{
var cacheService = App.GetService<ISysCacheService>();
var webAccService = App.GetService<IDjyWebsiteAccountConfigService>();
@ -53,7 +53,7 @@ namespace Myshipping.Application.Helper
if (ygtAcc == null || string.IsNullOrEmpty(ygtAcc.Account) || string.IsNullOrEmpty(ygtAcc.Password))
{
return new KeyValuePair<bool, string>(false, "未找到云港通账号、密码配置,请到账号维护模块中添加");
return (false, "未找到云港通账号、密码配置,请到账号维护模块中添加", "");
}
webAcc = ygtAcc.Account;
@ -68,7 +68,7 @@ namespace Myshipping.Application.Helper
if (ygtAcc == null || string.IsNullOrEmpty(ygtAcc.Account) || string.IsNullOrEmpty(ygtAcc.Password))
{
return new KeyValuePair<bool, string>(false, "未找到陆海通账号、密码配置,请到账号维护模块中添加");
return (false, "未找到陆海通账号、密码配置,请到账号维护模块中添加", "");
}
webAcc = ygtAcc.Account;
@ -79,7 +79,7 @@ namespace Myshipping.Application.Helper
var ym = yardMappings.FirstOrDefault(x => x.Code.ToLower() == yardid.ToLower() && x.Module == "BillTrace");
if (ym == null)
{
return new KeyValuePair<bool, string>(false, $"场站代号配置未找到:{yardid}");
return (false, $"场站代号配置未找到:{yardid}", "");
}
var objSend = new
@ -110,7 +110,7 @@ namespace Myshipping.Application.Helper
var rtnObj = JObject.Parse(rtn);
if (rtnObj.GetIntValue("code") != 200)
{
return new KeyValuePair<bool, string>(false, $"获取场站数失败:{rtnObj.GetStringValue("msg")}");
return (false, $"获取场站数失败:{rtnObj.GetStringValue("msg")}", "");
}
else
{
@ -123,8 +123,8 @@ namespace Myshipping.Application.Helper
rtnData = rtnData.Replace(viewstatehtml, "");
}
}
return new KeyValuePair<bool, string>(true, rtnData);
var rtnContact = rtnObj.GetJArrayValue("contact_list")?.ToJsonString() ?? "";
return (true, rtnData, rtnContact);
}
}
@ -139,15 +139,15 @@ namespace Myshipping.Application.Helper
/// <param name="yardid">场站ID</param>
/// <param name="isWeb">是否网站</param>
/// <returns>返回场站详情(按箱明细显示,并对箱型做了本地转换)</returns>
public static async Task<string> GetYardDataWithTranslateAsync(long userId, long tenantId, string tenantName, string mblno,
public static async Task<string> GetYardDataWithTranslateAsync(long userId, long tenantId, string tenantName, string mblno,
string yardid, bool isWeb = true)
{
var rtn = await GetYardData(userId, tenantId, tenantName, mblno, yardid, isWeb);
(bool isSuccess, string data, string contact) rtn = await GetYardData(userId, tenantId, tenantName, mblno, yardid, isWeb);
if (!rtn.Key)
if (!rtn.isSuccess)
{
throw Oops.Bah(rtn.Value);
}
throw Oops.Bah(rtn.data);
}
var _cache = App.GetService<ISysCacheService>();
@ -155,7 +155,7 @@ namespace Myshipping.Application.Helper
var ctnList = await _cache.GetAllCodeCtn();
var mapCtn = await _cache.GetAllMappingCtn();
var jData = JArray.Parse(rtn.Value);
var jData = JArray.Parse(rtn.data);
foreach (JObject item in jData)
{
var ctnall = item.GetStringValue("CTNALL");

@ -9216,17 +9216,17 @@ namespace Myshipping.Application
/// <returns></returns>
private async Task<List<BookingGetYardDataDto>> GetYardDataAndMappingSystem(BookingOrder order, bool isWeb = false)
{
var rtn = await YardDataHelper.GetYardData(App.User.FindFirst(ClaimConst.CLAINM_USERID) == null ? order.CreatedUserId.Value : UserManager.UserId, order.TenantId.Value, order.TenantName, order.MBLNO, order.YARDID, isWeb);
if (!rtn.Key)
(bool isSuccess, string data, string contact) rtn = await YardDataHelper.GetYardData(App.User.FindFirst(ClaimConst.CLAINM_USERID) == null ? order.CreatedUserId.Value : UserManager.UserId, order.TenantId.Value, order.TenantName, order.MBLNO, order.YARDID, isWeb);
if (!rtn.isSuccess)
{
throw Oops.Bah(rtn.Value);
throw Oops.Bah(rtn.data);
}
//场站引入的数据,转换为订舱箱型,且带上箱型代码
var ctnList = await _cache.GetAllCodeCtn();
var mapCtn = await _cache.GetAllMappingCtn();
var listRtn = JsonConvert.DeserializeObject<List<BookingGetYardDataDto>>(rtn.Value);
var listRtn = JsonConvert.DeserializeObject<List<BookingGetYardDataDto>>(rtn.data);
var contact = JsonConvert.DeserializeObject<List<YardContactDto>>(rtn.contact)?.FirstOrDefault();
foreach (var item in listRtn)
{
@ -9249,9 +9249,14 @@ namespace Myshipping.Application
{
throw Oops.Bah($"未找到箱型{ctnall}的场站引入配置");
}
}
// 赋值联系人信息
item.contact_tel = !string.IsNullOrEmpty(contact?.contact_tel1) ? contact?.contact_tel1 : contact?.contact_tel2;
item.contact_name = contact?.contact_name;
item.contact_email = contact?.contact_email;
}
return listRtn;
}
/// <summary>

@ -2633,7 +2633,7 @@ namespace Myshipping.Application
try
{
if (id < 0)
if (id <= 0)
throw Oops.Oh($"订舱ID为空");
var order = await _bookingOrderRepository.AsQueryable().FirstAsync(a => a.Id == id);

@ -127,11 +127,43 @@ namespace Myshipping.Application.Service.BookingOrder.Dto
}
public class BookingGetYardDataDto: BookingYardDataRtn
public class BookingGetYardDataDto : BookingYardDataRtn
{
/// <summary>
/// 箱型代码
/// </summary>
public string CtnCode { get; set; }
/// <summary>
/// 联系人姓名
/// </summary>
public string contact_name { get; set; }
/// <summary>
/// 联系方式
/// </summary>
public string contact_tel { get; set; }
/// <summary>
/// 联系邮箱
/// </summary>
public string contact_email { get; set; }
}
public class YardContactDto
{
/// <summary>
/// 联系人姓名
/// </summary>
public string contact_name { get; set; }
/// <summary>
/// 联系方式1
/// </summary>
public string contact_tel1 { get; set; }
/// <summary>
/// 联系方式2
/// </summary>
public string contact_tel2 { get; set; }
/// <summary>
/// 联系邮箱
/// </summary>
public string contact_email { get; set; }
}
}

Loading…
Cancel
Save