|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
using Aspose.Words.Saving;
|
|
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
|
using DSWeb.Areas.CommMng.PublicInterfaceDAL;
|
|
|
|
|
using DSWeb.Areas.MvcShipping.Models.Message.VGM;
|
|
|
|
|
using DSWeb.Common.DB;
|
|
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
@ -8,28 +10,37 @@ using System.Collections.Generic;
|
|
|
|
|
using System.Data.Entity.Core.Metadata.Edm;
|
|
|
|
|
using System.Data.Entity.Migrations;
|
|
|
|
|
using System.Diagnostics.Contracts;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Areas.CommMng.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class PublicInterfaceController
|
|
|
|
|
[JsonRequestBehavior]
|
|
|
|
|
public class PublicInterfaceController : Controller
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public InterfaceResult PostInterface(InterfaceParam param) {
|
|
|
|
|
try {
|
|
|
|
|
//[HttpPost]
|
|
|
|
|
public InterfaceResult PostInterface() {
|
|
|
|
|
|
|
|
|
|
var sr = new StreamReader(Request.InputStream, Encoding.UTF8);
|
|
|
|
|
var strJson = sr.ReadToEnd();
|
|
|
|
|
var param = JsonConvert.Deserialize<InterfaceParam>(strJson);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
param.Save();
|
|
|
|
|
Assembly assembly = Assembly.Load("DSWeb.Areas.CommMng.Controllers");
|
|
|
|
|
var type = assembly.GetType("DSWeb.Areas.CommMng.Controllers.InterfaceBase." + param.PORTNAME);
|
|
|
|
|
Assembly assembly = Assembly.Load("DSWeb");
|
|
|
|
|
var classname = "DSWeb.Areas.CommMng.PublicInterfaceDAL." + param.header.serviceCode;
|
|
|
|
|
var type = assembly.GetType(classname);
|
|
|
|
|
|
|
|
|
|
Object obj = type.Assembly.CreateInstance(type.ToString());
|
|
|
|
|
|
|
|
|
|
var doset = type.GetMethod("DoSet");
|
|
|
|
|
var _param = new object[]{ param};
|
|
|
|
|
var _param = new object[]{ param.body };
|
|
|
|
|
InterfaceResult result = (InterfaceResult)doset.Invoke(obj,BindingFlags.Instance|BindingFlags.NonPublic,null, _param, null);
|
|
|
|
|
return result;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -40,7 +51,7 @@ namespace DSWeb.Areas.CommMng.Controllers
|
|
|
|
|
if (e.InnerException != null && e.InnerException.Message != null) {
|
|
|
|
|
msg += "//InnerException.Message:" + e.InnerException.Message;
|
|
|
|
|
}
|
|
|
|
|
var _rs= BasicDataRefDAL.SaveLog(msg, "", param.PORTNAME, "公开接口");
|
|
|
|
|
var _rs= BasicDataRefDAL.SaveLog(msg, "", param.header.serviceCode, "公开接口");
|
|
|
|
|
var _rr = JsonConvert.Deserialize<DBResult>(_rs.Content);
|
|
|
|
|
_r.errMsg = "未知错误,请联系相关人员,错误日志号【" + _rr.Data.ToString() + "】";
|
|
|
|
|
return _r;
|
|
|
|
@ -48,78 +59,4 @@ namespace DSWeb.Areas.CommMng.Controllers
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 string PORTNAME { get; set; }
|
|
|
|
|
public string GID { get; set; }
|
|
|
|
|
|
|
|
|
|
public string Param { get; set; }
|
|
|
|
|
|
|
|
|
|
public t_PublicInterface_Log_md getsaverec() {
|
|
|
|
|
var result = new t_PublicInterface_Log_md();
|
|
|
|
|
result.GID= GID;
|
|
|
|
|
result.Param= Param;
|
|
|
|
|
result.PORTNAME = PORTNAME;
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class InterfaceBase
|
|
|
|
|
{
|
|
|
|
|
public InterfaceBase() { }
|
|
|
|
|
|
|
|
|
|
public InterfaceResult DoSet(InterfaceParam param) {
|
|
|
|
|
return new InterfaceResult();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//public static void SaveParam(InterfaceParam param) {
|
|
|
|
|
// param.Save();
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
public class csCustInfo: InterfaceBase
|
|
|
|
|
{
|
|
|
|
|
public InterfaceResult DoSet(InterfaceParam param)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
//解析param.Param
|
|
|
|
|
var _str = param.Param;
|
|
|
|
|
|
|
|
|
|
//向数据库保存
|
|
|
|
|
|
|
|
|
|
return new InterfaceResult(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|