From 17a976d647b9358e000215d5c96da5b7a4c62668 Mon Sep 17 00:00:00 2001 From: ddlucky Date: Wed, 17 Apr 2024 14:01:12 +0800 Subject: [PATCH] 20240417 --- .../Controllers/PublicInterfaceController.cs | 105 +++++++++- DSWeb/Areas/CommMng/DAL/PublicInterfaceDAL.cs | 185 ++++++++++++++++++ .../Dispatch/Controllers/WxAppController.cs | 2 +- DSWeb/DSWeb.csproj | 1 + 4 files changed, 282 insertions(+), 11 deletions(-) create mode 100644 DSWeb/Areas/CommMng/DAL/PublicInterfaceDAL.cs diff --git a/DSWeb/Areas/CommMng/Controllers/PublicInterfaceController.cs b/DSWeb/Areas/CommMng/Controllers/PublicInterfaceController.cs index 5b281e09..cf02dee8 100644 --- a/DSWeb/Areas/CommMng/Controllers/PublicInterfaceController.cs +++ b/DSWeb/Areas/CommMng/Controllers/PublicInterfaceController.cs @@ -212,21 +212,21 @@ namespace DSWeb.Areas.CommMng.Controllers var sr = new StreamReader(Request.InputStream, Encoding.UTF8); var strJson = sr.ReadToEnd(); //BasicDataRefDAL.SaveLog(strJson, "", "大简云比对", "删除业务"); - var param = JsonConvert.Deserialize(strJson); + var paramHead = JsonConvert.Deserialize(strJson); try { //param.Save(); InterfaceLog.Save("PublicInterface", strJson); Assembly assembly = Assembly.Load("DSWeb"); - var classname = "DSWeb.Areas.CommMng.PublicInterfaceDAL.DJYBILLDELETE"; + var classname = "DSWeb.Areas.CommMng.PublicInterfaceDAL."+ paramHead.PORTNAME; var type = assembly.GetType(classname); Object obj = type.Assembly.CreateInstance(type.ToString()); var doset = type.GetMethod("DoSet"); - var _param = new object[] { param }; - DJYBILLDELETE_REPLY result = (DJYBILLDELETE_REPLY)doset.Invoke(obj, BindingFlags.Instance | BindingFlags.NonPublic, null, _param, null); + var _param = new object[] { paramHead.Param }; + DBResult result = (DBResult)doset.Invoke(obj, BindingFlags.Instance | BindingFlags.NonPublic, null, _param, null); //var str = JsonConvert.Serialize(result); @@ -243,12 +243,8 @@ namespace DSWeb.Areas.CommMng.Controllers var _r = new DJYINFOBASE(); _r.Code = 1; - var msg = e.Message; - if (e.InnerException != null && e.InnerException.Message != null) - { - msg += "//InnerException.Message:" + e.InnerException.Message; - } - var _rs = BasicDataRefDAL.SaveLog(msg, "", "大简云比对", "删除业务"); + var msg = JsonConvert.Serialize(e); + var _rs = BasicDataRefDAL.SaveLog(msg, "", "PublicInterface", "错误"); //var _rr = JsonConvert.Deserialize(_rs.Content); _r.Message = msg; @@ -290,6 +286,95 @@ namespace DSWeb.Areas.CommMng.Controllers public string Param { get; set; } } + public class InterfaceParam_Base + { + public string PORTNAME { get; set; } + public string GID { get; set; } + public object Param { get; set; } + } + + + public class 全泰账单_Fee + { + /// + /// 单证费 + /// + public string cost_name { get; set; } + /// + /// + /// + public string cost_unit { get; set; } + /// + /// + /// + public string cost_price { get; set; } + /// + /// + /// + public string cost_count { get; set; } + /// + /// + /// + public string cost_currency { get; set; } + /// + /// + /// + public string cost_amount { get; set; } + } + + public class 全泰账单_Bill + { + /// + /// + /// + public string bill_no { get; set; } + /// + /// + /// + public string bill_date { get; set; } + /// + /// 正本提单 + /// + public string bill_type { get; set; } + /// + /// 已出单 + /// + public string bill_status { get; set; } + /// + /// + /// + public string bill_vessel { get; set; } + /// + /// + /// + public string bill_voyage { get; set; } + /// + /// + /// + public string bill_amount_usa { get; set; } + /// + /// + /// + public string bill_amount_rmb { get; set; } + /// + /// + /// + public string bill_container_type { get; set; } + /// + /// + /// + public string bill_container_count { get; set; } + /// + /// + /// + public string bill_remark { get; set; } + /// + /// + /// + public List<全泰账单_Fee> bill_details { get; set; } + } + + public static class InterfaceLog { public static void Save(string PORTNAME, object c) diff --git a/DSWeb/Areas/CommMng/DAL/PublicInterfaceDAL.cs b/DSWeb/Areas/CommMng/DAL/PublicInterfaceDAL.cs new file mode 100644 index 00000000..f9812110 --- /dev/null +++ b/DSWeb/Areas/CommMng/DAL/PublicInterfaceDAL.cs @@ -0,0 +1,185 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.Common; +using System.Data.Entity.Migrations; +using System.Data.Entity.Validation; +using System.Diagnostics; +using System.Linq; +using System.Runtime.Remoting.Messaging; +using System.Security.Permissions; +using System.ServiceModel.Configuration; +using System.Text; +using System.Web; +using System.Windows.Forms; +using DSWeb.Areas.CommMng.Controllers; +using DSWeb.Areas.CommMng.Models; +using DSWeb.Areas.MvcShipping.Models.Message.VGM; +using DSWeb.Common.DB; +using DSWeb.EntityDA; +using DSWeb.MvcShipping.Comm.Cookie; +using DSWeb.MvcShipping.Controllers; +using DSWeb.MvcShipping.Helper; +using HcUtility.Comm; +using Microsoft.Practices.EnterpriseLibrary.Data; +using Newtonsoft.Json.Linq; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; + +namespace DSWeb.Areas.CommMng.PublicInterfaceDAL +{ + public class InterfaceResult + { + public string errCode { get; set; } + public string errMsg { get; set; } + + public InterfaceResult() { } + + public InterfaceResult(DBResult dbresult) + { + if (dbresult.Success) + { + errCode = "0"; + } + else + { + errCode = "1"; + } + + errMsg = dbresult.Message + ";Data:" + JsonConvert.Serialize(dbresult.Data); + } + } + + public class InterfaceParam + { + public Interface_Header header { get; set; } + + public object body { get; set; } + + public t_PublicInterface_Log_md getsaverec() + { + var result = new t_PublicInterface_Log_md(); + try + { + result.GID = Guid.NewGuid().ToString(); + result.Param = body.ToString(); + result.PORTNAME = header.serviceCode; + result.CreateTime = DateTime.Now; + } + catch (Exception e) { + + } + return result; + } + + public void Save() + { + var saverec = getsaverec(); + if (!string.IsNullOrWhiteSpace(saverec.Param) && !string.IsNullOrWhiteSpace(saverec.PORTNAME)) + { + var cdc = new CommonDataContext(); + cdc.t_PublicInterface_Log.Add(saverec); + cdc.SaveChanges(); + } + } + } + public class Interface_Header + { + public string serviceCode { get; set; } + + } + + public static class InterfaceLog { + public static void Save(string PORTNAME,object c) { + var saverec = getsaverec(PORTNAME,c); + if (!string.IsNullOrWhiteSpace(saverec.Param) && !string.IsNullOrWhiteSpace(saverec.PORTNAME)) + { + var cdc = new CommonDataContext(); + cdc.t_PublicInterface_Log.Add(saverec); + cdc.SaveChanges(); + } + } + + private static t_PublicInterface_Log_md getsaverec(string PORTNAME, object c) + { + var result = new t_PublicInterface_Log_md(); + try + { + result.GID = Guid.NewGuid().ToString(); + result.PORTNAME= PORTNAME; + result.Param = JsonConvert.Serialize(c); + result.CreateTime = DateTime.Now; + } + catch (Exception e) + { + + } + return result; + } + } + public class InterfaceBase + { + public InterfaceBase() { } + + public virtual InterfaceResult DoSet(JObject paramObject) + { + return new InterfaceResult(); + } + + //public static void SaveParam(InterfaceParam param) { + // param.Save(); + //} + + + } + + + + #region 全泰 账单拆分 + + + /// + /// 全泰 账单拆分 + /// + public class 全泰账单 + { + + public DBResult DoSet(object Objectparam) + { + var paramstr = Objectparam.ToString(); + + //paramstr = paramstr.Remove(0, 1); + //paramstr = paramstr.Remove(paramstr.Length - 1, 1); + + var param = JsonConvert.Deserialize>(paramstr); + + var result = new DBResult(); + + try + { + InterfaceLog.Save("全泰账单解析", param); + + result.OK(); + } + catch (Exception ex) + { + //var newerror = new t_sys_soft_error_md(); + //newerror.针对版本 = 0; + //newerror.升级日期 = DateTime.Now; + //newerror.升级人 = "管理员"; + //newerror.执行文件 = $"[{ex.Message}]" + errorstr; + //var ds62 = new DS6DataContext(); + //ds62.t_sys_soft_error.Add(newerror); + //ds62.SaveChanges(); + + InterfaceLog.Save("全泰账单_Error", ex); + + result.SetErrorInfo(JsonConvert.Serialize(ex)); + return result; + } + + return result; + } + + } + #endregion +} \ No newline at end of file diff --git a/DSWeb/Areas/Dispatch/Controllers/WxAppController.cs b/DSWeb/Areas/Dispatch/Controllers/WxAppController.cs index 63b8ac1b..88a40279 100644 --- a/DSWeb/Areas/Dispatch/Controllers/WxAppController.cs +++ b/DSWeb/Areas/Dispatch/Controllers/WxAppController.cs @@ -991,7 +991,7 @@ namespace DSWeb.Areas.Dispatch.Controllers var infofilepath = InfoFilesPath + "/" + timename; if (extension == ".asp" || extension == ".aspx" || extension == ".html") { - return Json(new { Success = false, Message = "特定文件不允许上传", Data = JsonConvert.SerializeObject(newInfoFiles) }); + return Json(new { Success = false, Message = "特定文件不允许上传", Data = JsonConvert.SerializeObject(uploadFile.FileName) }); } var savePath = upDir + filepath; diff --git a/DSWeb/DSWeb.csproj b/DSWeb/DSWeb.csproj index 718a900e..2191f1cf 100644 --- a/DSWeb/DSWeb.csproj +++ b/DSWeb/DSWeb.csproj @@ -8244,6 +8244,7 @@ +