初始化
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
using BLV_API.Dal;
|
||||
using BLV_API.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace BLV_API.Controllers
|
||||
{
|
||||
public class ApiController : Controller
|
||||
{
|
||||
public ActionResult Index()
|
||||
{
|
||||
ViewBag.Title = "宝来威客控与PMS对接API";
|
||||
return View();
|
||||
}
|
||||
/// <summary>
|
||||
/// Luopan PMS对接
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ActionResult LuopanToBLV()
|
||||
{
|
||||
Request.InputStream.Position = 0;
|
||||
byte[] reqBody = new byte[Request.InputStream.Length];
|
||||
Request.InputStream.Read(reqBody, 0, reqBody.Length);
|
||||
string reqData = System.Text.Encoding.UTF8.GetString(reqBody);
|
||||
LogHelper.WriteLog("收到请求:" + reqData);
|
||||
try
|
||||
{
|
||||
LuopanEntity.Root req = JsonConvert.DeserializeObject<LuopanEntity.Root>(reqData);
|
||||
ServiceReference1.blwwsSoapClient client = new ServiceReference1.blwwsSoapClient();
|
||||
string errorMsg = "";
|
||||
bool blvResult;
|
||||
StringBuilder xmlString = new StringBuilder();
|
||||
string phoneNumber = "";
|
||||
string idNumber = "";
|
||||
switch (req.Action)
|
||||
{
|
||||
case "CheckIn"://入住
|
||||
if (req.GuestInfo.Count > 0)
|
||||
{
|
||||
phoneNumber = req.GuestInfo[0].Mobile;
|
||||
idNumber = req.GuestInfo[0].IDCardNo;
|
||||
xmlString.Append("<interface>");
|
||||
foreach (LuopanEntity.GuestInfo guest in req.GuestInfo)
|
||||
{
|
||||
xmlString.Append("<item idtype=" + guest.IDCardTypeId + " idcard ='" + guest.IDCardNo + "' customer='" + guest.GuestName + "' sex='" +
|
||||
(guest.Gender == 0 ? "男" : "女") + "' country=0 checkindate='" + req.CheckInTime.ToString("yyyy-MM-dd HH:mm:ss") + "'\\>");
|
||||
}
|
||||
xmlString.Append("</interface>");
|
||||
}
|
||||
blvResult = client.CheckIn("blw_ws@2015", req.HotelId, req.RoomNo, req.CheckInTime, xmlString.ToString(), ref errorMsg, phoneNumber, idNumber);
|
||||
LogHelper.WriteLog($"转发BLV内部开房接口,结果:{blvResult},消息:{errorMsg}");
|
||||
break;
|
||||
case "CheckOut"://退房
|
||||
blvResult = client.CheckOut("blw_ws@2015", req.HotelId, req.RoomNo, req.CheckOutTime, ref errorMsg);
|
||||
LogHelper.WriteLog($"转发BLV内部退房接口,结果:{blvResult},消息:{errorMsg}");
|
||||
break;
|
||||
case "MoveRoom"://换房
|
||||
//先退房
|
||||
blvResult = client.CheckOut("blw_ws@2015", req.HotelId, req.OldRoomNo, req.MoveTime, ref errorMsg);
|
||||
LogHelper.WriteLog($"转发BLV内部退房接口,结果:{blvResult},消息:{errorMsg}");
|
||||
//再开房
|
||||
if (req.GuestInfo.Count > 0)
|
||||
{
|
||||
phoneNumber = req.GuestInfo[0].Mobile;
|
||||
idNumber = req.GuestInfo[0].IDCardNo;
|
||||
xmlString.Append("<interface>");
|
||||
foreach (LuopanEntity.GuestInfo guest in req.GuestInfo)
|
||||
{
|
||||
xmlString.Append("<item idtype=" + guest.IDCardTypeId + " idcard ='" + guest.IDCardNo + "' customer='" + guest.GuestName + "' sex='" +
|
||||
(guest.Gender == 0 ? "男" : "女") + "' country=0 checkindate='" + req.CheckInTime.ToString("yyyy-MM-dd HH:mm:ss") + "'\\>");
|
||||
}
|
||||
xmlString.Append("</interface>");
|
||||
}
|
||||
blvResult = client.CheckIn("blw_ws@2015", req.HotelId, req.NewRoomNo, req.CheckInTime, xmlString.ToString(), ref errorMsg, phoneNumber, idNumber);
|
||||
LogHelper.WriteLog($"转发BLV内部开房接口,结果:{blvResult},消息:{errorMsg}");
|
||||
break;
|
||||
case "Extend"://续住
|
||||
|
||||
break;
|
||||
}
|
||||
return Json(new LuopanEntity.Result() { status = 0, error_msg = "" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Json(new LuopanEntity.Result() { status = 1, error_msg = ex.Message }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
# Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
# This file contains command-line options that the C#
|
||||
# command line compiler (CSC) will process as part
|
||||
# of every compilation, unless the "/noconfig" option
|
||||
# is specified.
|
||||
|
||||
# Reference the common Framework libraries
|
||||
/r:Accessibility.dll
|
||||
/r:Microsoft.CSharp.dll
|
||||
/r:System.Configuration.dll
|
||||
/r:System.Configuration.Install.dll
|
||||
/r:System.Core.dll
|
||||
/r:System.Data.dll
|
||||
/r:System.Data.DataSetExtensions.dll
|
||||
/r:System.Data.Linq.dll
|
||||
/r:System.Data.OracleClient.dll
|
||||
/r:System.Deployment.dll
|
||||
/r:System.Design.dll
|
||||
/r:System.DirectoryServices.dll
|
||||
/r:System.dll
|
||||
/r:System.Drawing.Design.dll
|
||||
/r:System.Drawing.dll
|
||||
/r:System.EnterpriseServices.dll
|
||||
/r:System.Management.dll
|
||||
/r:System.Messaging.dll
|
||||
/r:System.Runtime.Remoting.dll
|
||||
/r:System.Runtime.Serialization.dll
|
||||
/r:System.Runtime.Serialization.Formatters.Soap.dll
|
||||
/r:System.Security.dll
|
||||
/r:System.ServiceModel.dll
|
||||
/r:System.ServiceModel.Web.dll
|
||||
/r:System.ServiceProcess.dll
|
||||
/r:System.Transactions.dll
|
||||
/r:System.Web.dll
|
||||
/r:System.Web.Extensions.Design.dll
|
||||
/r:System.Web.Extensions.dll
|
||||
/r:System.Web.Mobile.dll
|
||||
/r:System.Web.RegularExpressions.dll
|
||||
/r:System.Web.Services.dll
|
||||
/r:System.Windows.Forms.dll
|
||||
/r:System.Workflow.Activities.dll
|
||||
/r:System.Workflow.ComponentModel.dll
|
||||
/r:System.Workflow.Runtime.dll
|
||||
/r:System.Xml.dll
|
||||
/r:System.Xml.Linq.dll
|
||||
Reference in New Issue
Block a user