booking_auth_dev
wet 2 years ago
commit 4f8bde9e55

@ -1,10 +1,13 @@
using Furion; using Furion;
using Furion.Logging; using Furion.Logging;
using Furion.RemoteRequest.Extensions;
using Microsoft.Extensions.Logging;
using Myshipping.Application.ConfigOption; using Myshipping.Application.ConfigOption;
using Myshipping.Application.Entity; using Myshipping.Application.Entity;
using Myshipping.Core; using Myshipping.Core;
using Myshipping.Core.Entity; using Myshipping.Core.Entity;
using Myshipping.Core.Service; using Myshipping.Core.Service;
using Newtonsoft.Json.Linq;
using SqlSugar; using SqlSugar;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -13,25 +16,25 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Myshipping.Application.EDI.Yard namespace Myshipping.Application.EDI
{ {
/// <summary> /// <summary>
/// 下货纸辅助类 /// 下货纸辅助类
/// </summary> /// </summary>
public static class XiahuozhiHelpler public static class XiahuozhiHelpler
{ {
private static readonly string EdiFilePath = "XHZ";
public static bool Send( public static bool Send(
//SqlSugarRepository<BookingOrder> repOrder, long bookingId, string filerole, out string msg)
//SqlSugarRepository<BookingCtn> repCtn,
//SqlSugarRepository<SysDictType> repDictType,
//SqlSugarRepository<SysDictData> repDictData,
//SqlSugarRepository<BookingFile> repBookingFile,
//SqlSugarRepository<DjyEdiSetting> repEdiSetting,
long bookingId, string filerole, out string msg, string attShowName = "系统")
{ {
var sugerClient = App.GetService<ISqlSugarClient>(); var repOrder = App.GetService<SqlSugarRepository<BookingOrder>>();
var repCtn = App.GetService<SqlSugarRepository<BookingCtn>>();
var repBookingFile = App.GetService<SqlSugarRepository<BookingFile>>();
var cacheService = App.GetService<ISysCacheService>();
var order = sugerClient.Queryable<BookingOrder>().First(o => o.Id == bookingId); var order = repOrder.FirstOrDefault(o => o.Id == bookingId);
if (order == null) if (order == null)
{ {
msg = "订舱信息未找到"; msg = "订舱信息未找到";
@ -64,9 +67,9 @@ namespace Myshipping.Application.EDI.Yard
} }
var fileOpt = App.GetOptions<BookingAttachOptions>(); var fileOpt = App.GetOptions<BookingAttachOptions>();
if (!Directory.Exists(fileOpt.basePath)) if (string.IsNullOrEmpty(fileOpt.basePath))
{ {
Directory.CreateDirectory(fileOpt.basePath); fileOpt.basePath = AppDomain.CurrentDomain.BaseDirectory;
} }
@ -91,20 +94,23 @@ namespace Myshipping.Application.EDI.Yard
var paraXHZ = GetAllTenantParam().Result.FirstOrDefault(p => p.TenantId == order.TenantId && p.ParaCode == "CODE_GLJ_XHZ"); var paraXHZ = GetAllTenantParam().Result.FirstOrDefault(p => p.TenantId == order.TenantId && p.ParaCode == "CODE_GLJ_XHZ");
if (paraXHZ == null || string.IsNullOrEmpty(paraXHZ.ItemCode)) if (paraXHZ == null || string.IsNullOrEmpty(paraXHZ.ItemCode))
{ {
msg = "下货纸代号未找到或配置有误"; msg = $"{order.TenantName} 港联捷场站 下货纸代号未找到或配置有误";
return false; return false;
} }
var ediFileName = $"{paraXHZ.ItemCode}_{order.MBLNO}_{DateTime.Now.Ticks}.txt"; var ediFileName = $"{paraXHZ.ItemCode}_{order.MBLNO}_{DateTime.Now.Ticks}.txt";
var ediFileRela = Path.Combine("XHZ", ediFileName); var ediFileRela = Path.Combine(EdiFilePath, ediFileName);
var ediFileAbs = Path.Combine(fileOpt.basePath, ediFileRela); var ediPathAbs = Path.Combine(fileOpt.basePath, EdiFilePath);
var ediFileAbs = Path.Combine(ediPathAbs, ediFileRela);
if (!Directory.Exists(ediPathAbs))
{
Directory.CreateDirectory(ediPathAbs);
}
//港联捷所有用户使用一个ftp用户名和密码发送报文使用文件名中的下货纸代号进行区分 //港联捷所有用户使用一个ftp用户名和密码发送报文使用文件名中的下货纸代号进行区分
var dicTypeGLJ = repDictType.FirstOrDefault(x => x.Code == "booking_ftp_setting_glj"); var paraServer = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "ftp_server");
var dicDataGLJ = repDictData.Where(x => x.TypeId == dicTypeGLJ.Id).ToList(); var paraUser = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "username");
var paraServer = dicDataGLJ.FirstOrDefault(x => x.Code == "ftp_server").Value; var paraPwd = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "pwd");
var paraUser = dicDataGLJ.FirstOrDefault(x => x.Code == "username").Value;
var paraPwd = dicDataGLJ.FirstOrDefault(x => x.Code == "pwd").Value;
if (paraServer == null || paraUser == null || paraPwd == null) if (paraServer == null || paraUser == null || paraPwd == null)
{ {
@ -132,7 +138,7 @@ namespace Myshipping.Application.EDI.Yard
var ctnCodes = GetAllCodeCtn().Result.Select(x => new { x.Code, x.Size }).ToList(); var ctnCodes = GetAllCodeCtn().Result.Select(x => new { x.Code, x.Size }).ToList();
var ctnEdiList = GetAllMappingCtn().Result.AsQueryable().Where(x => x.Module == "XHZ_GLJ" && x.CarrierCode == order.CARRIERID).ToList(); var ctnEdiList = GetAllMappingCtn().Result.AsQueryable().Where(x => x.Module == "XHZ_GLJ" && x.CarrierCode == order.CARRIERID).ToList();
var ctns = sugerClient.Queryable<BookingCtn>().Where(c => c.BILLID == bookingId).ToList(); var ctns = repCtn.Where(c => c.BILLID == bookingId).ToList();
foreach (var ctn in ctns) foreach (var ctn in ctns)
{ {
var ctnFind = ctnCodes.FirstOrDefault(c => c.Code == ctn.CTNCODE); var ctnFind = ctnCodes.FirstOrDefault(c => c.Code == ctn.CTNCODE);
@ -156,15 +162,27 @@ namespace Myshipping.Application.EDI.Yard
File.WriteAllText(ediFileAbs, sbData.ToString()); File.WriteAllText(ediFileAbs, sbData.ToString());
//发送ftp //发送ftp
//BackgroundTaskFtp ftpTask = new BackgroundTaskFtp(); var ftpPostObj = new
//ftpTask.GID = Guid.NewGuid().ToString(); {
//ftpTask.FtpHost = paraServer.PARAMVALUE; host = paraServer.Value,
//ftpTask.FtpUser = paraUser.PARAMVALUE; username = paraUser.Value,
//ftpTask.FtpPassword = paraPwd.PARAMVALUE; pwd = paraPwd.Value,
//ftpTask.FtpData = FtpTaskHelper.GenTaskJson("", ediFile, null); path = "/"
//ftpTask.Type = BackgroundTaskFtp.TypeFtpUpload; };
//commonData.BackgroundTaskFtp.Add(ftpTask); var ftpSpiderUrl = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "booking_edi_ftp_server").Value;
//commonData.SaveChanges(); Log.Information($"准备请求发送ftp{ftpSpiderUrl} ,参数:{ftpPostObj.ToJsonString()},文件:{ediFileName}");
var res = ftpSpiderUrl
.SetContentType("multipart/form-data")
.SetBody(ftpPostObj)
.SetBodyBytes(("file", Encoding.UTF8.GetBytes(sbData.ToString()), ediFileName))
.PostAsStringAsync();
Log.Information($"发送ftp返回{res}");
var jobjRetn = JObject.Parse(res.Result);
if (jobjRetn.GetStringValue("status") != "1")
{
msg = $"ftp发送失败{jobjRetn.GetStringValue("message")}";
return false;
}
//挂载附件 //挂载附件
var attFile = new BookingFile(); var attFile = new BookingFile();
@ -174,7 +192,7 @@ namespace Myshipping.Application.EDI.Yard
attFile.TypeCode = "xiahuozhi"; attFile.TypeCode = "xiahuozhi";
attFile.TypeName = "下货纸"; attFile.TypeName = "下货纸";
attFile.TenantName = order.TenantName; attFile.TenantName = order.TenantName;
sugerClient.Insertable(attFile).ExecuteCommand(); repBookingFile.Insert(attFile);
msg = "已发送"; msg = "已发送";
return true; return true;
@ -209,17 +227,22 @@ namespace Myshipping.Application.EDI.Yard
} }
var ediFileName = $"{order.VESSEL}_{order.VOYNO}_{order.MBLNO}_{DateTime.Now.Ticks}.txt"; var ediFileName = $"{order.VESSEL}_{order.VOYNO}_{order.MBLNO}_{DateTime.Now.Ticks}.txt";
var ediFileRela = Path.Combine("XHZ", ediFileName); var ediFileRela = Path.Combine(EdiFilePath, ediFileName);
var ediFileAbs = Path.Combine(fileOpt.basePath, ediFileRela); var ediPathAbs = Path.Combine(fileOpt.basePath, EdiFilePath);
var ediFileAbs = Path.Combine(ediPathAbs, ediFileRela);
if (!Directory.Exists(ediPathAbs))
{
Directory.CreateDirectory(ediPathAbs);
}
DjyEdiSetting ftpset = null; DjyEdiSetting ftpset = null;
if (order.YARD == "港捷丰场站") if (order.YARD == "港捷丰场站")
{ {
ftpset = repEdiSetting.FirstOrDefault(f => f.EDINAME == "XHZ_GJF" && f.TenantId == order.TenantId); ftpset = cacheService.GetAllEdiSetting().Result.FirstOrDefault(f => f.EDINAME == "XHZ_GJF" && f.TenantId == order.TenantId);
} }
else if (order.YARD == "捷丰场站") else if (order.YARD == "捷丰场站")
{ {
ftpset = repEdiSetting.FirstOrDefault(f => f.EDINAME == "XHZ_JIEFENG" && f.TenantId == order.TenantId); ftpset = cacheService.GetAllEdiSetting().Result.FirstOrDefault(f => f.EDINAME == "XHZ_JIEFENG" && f.TenantId == order.TenantId);
} }
if (ftpset == null) if (ftpset == null)
@ -406,15 +429,27 @@ namespace Myshipping.Application.EDI.Yard
File.WriteAllText(ediFileAbs, strJoin, Encoding.Default); File.WriteAllText(ediFileAbs, strJoin, Encoding.Default);
//后续发送 //后续发送
//BackgroundTaskFtp ftpTask = new BackgroundTaskFtp(); var ftpPostObj = new
//ftpTask.GID = Guid.NewGuid().ToString(); {
//ftpTask.FtpHost = ftpset.SERVERIP; host = ftpset.SERVERIP,
//ftpTask.FtpUser = ftpset.USERNAME; username = ftpset.USERNAME,
//ftpTask.FtpPassword = ftpset.PASSWORD; pwd = ftpset.PASSWORD,
//ftpTask.FtpData = FtpTaskHelper.GenTaskJson(ftpset.FOLDERNAME, ediFile, null); path = ftpset.FOLDERNAME
//ftpTask.Type = BackgroundTaskFtp.TypeFtpUpload; };
//commonData.BackgroundTaskFtp.Add(ftpTask); var ftpSpiderUrl = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "booking_edi_ftp_server").Value;
//commonData.SaveChanges(); Log.Information($"准备请求发送ftp{ftpSpiderUrl} ,参数:{ftpPostObj.ToJsonString()},文件:{ediFileName}");
var res = ftpSpiderUrl
.SetContentType("multipart/form-data")
.SetBody(ftpPostObj)
.SetBodyBytes(("file", Encoding.UTF8.GetBytes(strJoin), ediFileName))
.PostAsStringAsync();
Log.Information($"发送ftp返回{res}");
var jobjRetn = JObject.Parse(res.Result);
if (jobjRetn.GetStringValue("status") != "1")
{
msg = $"ftp发送失败{jobjRetn.GetStringValue("message")}";
return false;
}
//挂载附件 //挂载附件
@ -439,7 +474,7 @@ namespace Myshipping.Application.EDI.Yard
var pGlxEdi = GetAllTenantParam().Result.FirstOrDefault(p => p.TenantId == order.TenantId && p.ParaCode == "XIAHUOZHI_GLX_SEND_TYPE"); var pGlxEdi = GetAllTenantParam().Result.FirstOrDefault(p => p.TenantId == order.TenantId && p.ParaCode == "XIAHUOZHI_GLX_SEND_TYPE");
if (order.YARD == "港联欣场站" && pGlxEdi != null && pGlxEdi.ItemCode == "EDI_GLJ") if (order.YARD == "港联欣场站" && pGlxEdi != null && pGlxEdi.ItemCode == "EDI_GLJ")
{ {
var ftpset = repEdiSetting.FirstOrDefault(f => f.EDINAME == "XHZ_GLX" && f.TenantId == order.TenantId); var ftpset = cacheService.GetAllEdiSetting().Result.FirstOrDefault(f => f.EDINAME == "XHZ_GLX" && f.TenantId == order.TenantId);
if (ftpset == null) if (ftpset == null)
{ {
msg = "港联欣下货纸ftp设置未找到"; msg = "港联欣下货纸ftp设置未找到";
@ -454,8 +489,13 @@ namespace Myshipping.Application.EDI.Yard
} }
var ediFileName = $"{paraXHZ.ItemCode}_{order.MBLNO}_{DateTime.Now.Ticks}.txt"; var ediFileName = $"{paraXHZ.ItemCode}_{order.MBLNO}_{DateTime.Now.Ticks}.txt";
var ediFileRela = Path.Combine("XHZ", ediFileName); var ediFileRela = Path.Combine(EdiFilePath, ediFileName);
var ediFileAbs = Path.Combine(fileOpt.basePath, ediFileRela); var ediPathAbs = Path.Combine(fileOpt.basePath, EdiFilePath);
var ediFileAbs = Path.Combine(ediPathAbs, ediFileRela);
if (!Directory.Exists(ediPathAbs))
{
Directory.CreateDirectory(ediPathAbs);
}
StringBuilder sbData = new StringBuilder(); StringBuilder sbData = new StringBuilder();
sbData.AppendLine($"01:{order.VESSEL}:{order.VOYNO}"); //船名 航次 sbData.AppendLine($"01:{order.VESSEL}:{order.VOYNO}"); //船名 航次
@ -495,15 +535,27 @@ namespace Myshipping.Application.EDI.Yard
File.WriteAllText(ediFileAbs, sbData.ToString()); File.WriteAllText(ediFileAbs, sbData.ToString());
//后续发送 //后续发送
//BackgroundTaskFtp ftpTask = new BackgroundTaskFtp(); var ftpPostObj = new
//ftpTask.GID = Guid.NewGuid().ToString(); {
//ftpTask.FtpHost = ftpset.SERVERIP; host = ftpset.SERVERIP,
//ftpTask.FtpUser = ftpset.USERNAME; username = ftpset.USERNAME,
//ftpTask.FtpPassword = ftpset.PASSWORD; pwd = ftpset.PASSWORD,
//ftpTask.FtpData = FtpTaskHelper.GenTaskJson("", ediFile, null); path = ftpset.FOLDERNAME
//ftpTask.Type = BackgroundTaskFtp.TypeFtpUpload; };
//commonData.BackgroundTaskFtp.Add(ftpTask); var ftpSpiderUrl = cacheService.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "booking_edi_ftp_server").Value;
//commonData.SaveChanges(); Log.Information($"准备请求发送ftp{ftpSpiderUrl} ,参数:{ftpPostObj.ToJsonString()},文件:{ediFileName}");
var res = ftpSpiderUrl
.SetContentType("multipart/form-data")
.SetBody(ftpPostObj)
.SetBodyBytes(("file", Encoding.UTF8.GetBytes(sbData.ToString()), ediFileName))
.PostAsStringAsync();
Log.Information($"发送ftp返回{res}");
var jobjRetn = JObject.Parse(res.Result);
if (jobjRetn.GetStringValue("status") != "1")
{
msg = $"ftp发送失败{jobjRetn.GetStringValue("message")}";
return false;
}
//挂载附件 //挂载附件
var attFile = new BookingFile(); var attFile = new BookingFile();
@ -522,53 +574,53 @@ namespace Myshipping.Application.EDI.Yard
msg = "场站联系人邮箱不能为空"; msg = "场站联系人邮箱不能为空";
return false; return false;
} }
// MailDataContext mailData = new MailDataContext(); // MailDataContext mailData = new MailDataContext();
// var userMail = mailData.UserAccounts.AsNoTracking().FirstOrDefault(ua => ua.UserId == order.USERID); // var userMail = mailData.UserAccounts.AsNoTracking().FirstOrDefault(ua => ua.UserId == order.USERID);
// if (userMail == null // if (userMail == null
// || string.IsNullOrEmpty(userMail.SmtpServer) // || string.IsNullOrEmpty(userMail.SmtpServer)
// || userMail.SmtpPort == 0) // || userMail.SmtpPort == 0)
// { // {
// msg = "发件邮箱未配置"; // msg = "发件邮箱未配置";
// return false; // return false;
// } // }
// var userbase = sugerClient.Queryable<SysUser>().First(u => u.Id == order.CreatedUserId); // var userbase = sugerClient.Queryable<SysUser>().First(u => u.Id == order.CreatedUserId);
// var title = $"下货纸:{order.MBLNO}/{order.CARRIER}/{order.VESSEL}/{order.VOYNO}/{order.TenantName}"; // var title = $"下货纸:{order.MBLNO}/{order.CARRIER}/{order.VESSEL}/{order.VOYNO}/{order.TenantName}";
// var bodyExt = string.Empty; // var bodyExt = string.Empty;
// if (order.CARGOID == "R") // if (order.CARGOID == "R")
// { // {
// bodyExt = $@"温度:{order.TEMPSET}{order.TEMPID}<br/> // bodyExt = $@"温度:{order.TEMPSET}{order.TEMPID}<br/>
//通风:{order.REEFERF}<br/> //通风:{order.REEFERF}<br/>
//湿度:{order.HUMIDITY}<br/>"; //湿度:{order.HUMIDITY}<br/>";
// } // }
// else if (order.CARGOID == "D") // else if (order.CARGOID == "D")
// { // {
// bodyExt = $@"危险品等级:{order.DCLASS}<br/> // bodyExt = $@"危险品等级:{order.DCLASS}<br/>
//危险品编号:{order.DUNNO}<br/> //危险品编号:{order.DUNNO}<br/>
//危险品联系方式:{order.LINKMAN}<br/>"; //危险品联系方式:{order.LINKMAN}<br/>";
// } // }
// var body = $@"提单号:{order.MBLNO}<br/> // var body = $@"提单号:{order.MBLNO}<br/>
//船名航次:{order.VESSEL}/{order.VOYNO}<br/> //船名航次:{order.VESSEL}/{order.VOYNO}<br/>
//起运港:{order.PORTLOAD},{order.PORTLOADID}<br/> //起运港:{order.PORTLOAD},{order.PORTLOADID}<br/>
//目的港:{order.PORTDISCHARGE},{order.PORTDISCHARGEID}<br/> //目的港:{order.PORTDISCHARGE},{order.PORTDISCHARGEID}<br/>
//目的地:{order.DESTINATION},{order.DESTINATIONID}<br/> //目的地:{order.DESTINATION},{order.DESTINATIONID}<br/>
//预计船期:{(order.ETD.HasValue ? order.ETD.Value.ToString("yyyy-MM-dd") : "")}<br/> //预计船期:{(order.ETD.HasValue ? order.ETD.Value.ToString("yyyy-MM-dd") : "")}<br/>
//箱型箱量:{order.CNTRTOTAL}<br/> //箱型箱量:{order.CNTRTOTAL}<br/>
//件重尺:{order.PKGS} {order.KINDPKGS}/{order.KGS}KGS/{order.CBM}CBM<br/> //件重尺:{order.PKGS} {order.KINDPKGS}/{order.KGS}KGS/{order.CBM}CBM<br/>
//货物描述:{order.DESCRIPTION}<br/> //货物描述:{order.DESCRIPTION}<br/>
//{bodyExt} //{bodyExt}
//备注:{order.YARDREMARK}<br/> //备注:{order.YARDREMARK}<br/>
//<br/> //<br/>
//订舱代理:{order.TenantName}<br/> //订舱代理:{order.TenantName}<br/>
//联系人:{order.CreatedUserName}<br/> //联系人:{order.CreatedUserName}<br/>
//电话:{userbase.Tel} 手机:{userbase.Phone}<br/> //电话:{userbase.Tel} 手机:{userbase.Phone}<br/>
//邮箱:{userbase.Email}<br/> //邮箱:{userbase.Email}<br/>
//"; //";
// MailHelper.SendMail(userMail.GID, title, body, order.YardContractEmail, customerSend: true); // MailHelper.SendMail(userMail.GID, title, body, order.YardContractEmail, customerSend: true);
} }
msg = "已发送"; msg = "已发送";
return true; return true;

@ -13,7 +13,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="EDI\Yard\XiahuozhiHelpler.cs" />
<Compile Remove="Entity\DjyBooking.cs" /> <Compile Remove="Entity\DjyBooking.cs" />
<Compile Remove="Service\BookingCtnDetail\BookingCtnDetailService.cs" /> <Compile Remove="Service\BookingCtnDetail\BookingCtnDetailService.cs" />
<Compile Remove="Service\BookingCtnDetail\IBookingCtnDetailService.cs" /> <Compile Remove="Service\BookingCtnDetail\IBookingCtnDetailService.cs" />
@ -35,8 +34,4 @@
<ProjectReference Include="..\Myshipping.Core\Myshipping.Core.csproj" /> <ProjectReference Include="..\Myshipping.Core\Myshipping.Core.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="EDI\Yard\" />
</ItemGroup>
</Project> </Project>

@ -34,6 +34,81 @@
订舱附件文件配置 订舱附件文件配置
</summary> </summary>
</member> </member>
<member name="T:Myshipping.Application.EDI.XiahuozhiHelpler">
<summary>
下货纸辅助类
</summary>
</member>
<member name="M:Myshipping.Application.EDI.XiahuozhiHelpler.formatEdiStr(System.String,System.String)">
<summary>
各种文本转义字符东胜7移植
</summary>
<param name="fileType">文件类型例如txt、xml</param>
<param name="str">文本字符串</param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.EDI.XiahuozhiHelpler.GetCtnEDICode(System.String,System.String)">
<summary>
获取箱型的EDI代码
</summary>
<param name="ctnCode"></param>
<param name="EDINAME"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.EDI.XiahuozhiHelpler.GetAllCodeCtn">
<summary>
获取所有箱型(使用缓存)
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Application.EDI.XiahuozhiHelpler.GetAllCodeCarrier">
<summary>
获取所有船司(使用缓存)
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Application.EDI.XiahuozhiHelpler.GetAllMappingCtn">
<summary>
获取所有箱型映射(使用缓存)
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Application.EDI.XiahuozhiHelpler.GetAllMappingCarrier">
<summary>
获取所有船司映射(使用缓存)
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Application.EDI.XiahuozhiHelpler.GetAllCodeFrt">
<summary>
获取所有付费方式(使用缓存)
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Application.EDI.XiahuozhiHelpler.GetAllMappingFrt">
<summary>
获取所有付费方式映射(使用缓存)
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Application.EDI.XiahuozhiHelpler.GetAllTenantParam">
<summary>
获取所有公司参数(使用缓存)
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Application.EDI.XiahuozhiHelpler.GetAllCodeVessel">
<summary>
获取所有船名(使用缓存)
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Application.EDI.XiahuozhiHelpler.GetAllMappingVessel">
<summary>
获取所有船名映射(使用缓存)
</summary>
<returns></returns>
</member>
<member name="T:Myshipping.Application.Entity.BookingCtn"> <member name="T:Myshipping.Application.Entity.BookingCtn">
<summary> <summary>

@ -30,6 +30,7 @@ using Myshipping.Core.Entity;
using Furion.RemoteRequest.Extensions; using Furion.RemoteRequest.Extensions;
using System.Net.Http; using System.Net.Http;
using Myshipping.Core.Service; using Myshipping.Core.Service;
using Myshipping.Application.EDI;
namespace Myshipping.Application namespace Myshipping.Application
{ {

@ -14,6 +14,8 @@ using Myshipping.Application.ConfigOption;
using System.IO; using System.IO;
using Yitter.IdGenerator; using Yitter.IdGenerator;
using Furion.FriendlyException; using Furion.FriendlyException;
using Furion.RemoteRequest.Extensions;
using System.Text;
namespace Myshipping.Application namespace Myshipping.Application
{ {
@ -202,5 +204,6 @@ namespace Myshipping.Application
//{ //{
// return await _rep.ToListAsync(); // return await _rep.ToListAsync();
//} //}
} }
} }

@ -0,0 +1,134 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Core
{
public static class JsonExtension
{
/// <summary>
/// 获取JObject
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static JObject GetJObjectValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return null;
}
return jt as JObject;
}
/// <summary>
/// 获取字符串值
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static string GetStringValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return string.Empty;
}
return jt.ToString();
}
/// <summary>
/// 获取int值
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static int GetIntValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return 0;
}
var strVal = jt.ToString();
int rtnVal = 0;
int.TryParse(strVal, out rtnVal);
return rtnVal;
}
/// <summary>
/// 获取decimal值
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static decimal GetDecimalValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return 0;
}
var strVal = jt.ToString();
decimal rtnVal = 0;
decimal.TryParse(strVal, out rtnVal);
return rtnVal;
}
/// <summary>
/// 获取datetime值
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static DateTime? GetDateTimeValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return null;
}
var strVal = jt.ToString();
DateTime rtnVal = DateTime.MinValue;
if (DateTime.TryParse(strVal, out rtnVal))
{
return rtnVal;
}
return null;
}
/// <summary>
/// 获取datetime值不带秒yyyy-MM-dd HH:mm
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static DateTime? GetDateTimeMinuteValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return null;
}
var strVal = jt.ToString() + ":00";
DateTime rtnVal = DateTime.MinValue;
if (DateTime.TryParse(strVal, out rtnVal))
{
return rtnVal;
}
return null;
}
}
}

@ -4492,6 +4492,54 @@
降序排序(不要问我为什么是descend不是desc前端约定参数就是这样) 降序排序(不要问我为什么是descend不是desc前端约定参数就是这样)
</summary> </summary>
</member> </member>
<member name="M:Myshipping.Core.JsonExtension.GetJObjectValue(Newtonsoft.Json.Linq.JObject,System.String)">
<summary>
获取JObject
</summary>
<param name="jobj"></param>
<param name="prop"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.JsonExtension.GetStringValue(Newtonsoft.Json.Linq.JObject,System.String)">
<summary>
获取字符串值
</summary>
<param name="jobj"></param>
<param name="prop"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.JsonExtension.GetIntValue(Newtonsoft.Json.Linq.JObject,System.String)">
<summary>
获取int值
</summary>
<param name="jobj"></param>
<param name="prop"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.JsonExtension.GetDecimalValue(Newtonsoft.Json.Linq.JObject,System.String)">
<summary>
获取decimal值
</summary>
<param name="jobj"></param>
<param name="prop"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.JsonExtension.GetDateTimeValue(Newtonsoft.Json.Linq.JObject,System.String)">
<summary>
获取datetime值
</summary>
<param name="jobj"></param>
<param name="prop"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.JsonExtension.GetDateTimeMinuteValue(Newtonsoft.Json.Linq.JObject,System.String)">
<summary>
获取datetime值不带秒yyyy-MM-dd HH:mm
</summary>
<param name="jobj"></param>
<param name="prop"></param>
<returns></returns>
</member>
<member name="T:Myshipping.Core.PagedQueryableExtensions"> <member name="T:Myshipping.Core.PagedQueryableExtensions">
<summary> <summary>
分页拓展类 分页拓展类

Loading…
Cancel
Save