初始化
This commit is contained in:
441
ConsoleApp1/Program.cs
Normal file
441
ConsoleApp1/Program.cs
Normal file
@@ -0,0 +1,441 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Messaging;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using BLWWS_BLL;
|
||||
using ConsoleApp1;
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
|
||||
namespace ConsoleApp1
|
||||
{
|
||||
|
||||
public class portinfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string LodgerNmae { get; set; }
|
||||
/// <summary>
|
||||
/// 身份证
|
||||
/// </summary>
|
||||
public string IDNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 性别 0女 1男
|
||||
/// </summary>
|
||||
public Nullable<int> Sex { get; set; }
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public Nullable<System.DateTime> CheckInDate { get; set; }
|
||||
/// <summary>
|
||||
/// 消息来源
|
||||
/// </summary>
|
||||
public int Sourcedian { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图片
|
||||
/// </summary>
|
||||
public string picture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图片时间
|
||||
/// </summary>
|
||||
public Nullable<System.DateTime> pictureDate { get; set; }
|
||||
/// <summary>
|
||||
/// 酒店code
|
||||
/// </summary>
|
||||
public string HotelCode { get; set; }
|
||||
/// <summary>
|
||||
/// 房间号
|
||||
/// </summary>
|
||||
public string roomid { get; set; }
|
||||
/// <summary>
|
||||
/// 电话号码
|
||||
/// </summary>
|
||||
public string phonenumber { get; set; }
|
||||
/// <summary>
|
||||
/// 开房时间
|
||||
/// </summary>
|
||||
public DateTime CheckTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 退房时间
|
||||
/// </summary>
|
||||
public DateTime checkOutTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密钥
|
||||
/// </summary>
|
||||
public string key { get; set; }
|
||||
public int pmsinfoid { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class XMSData
|
||||
{
|
||||
public string hotelid { get; set; }
|
||||
/// <summary>
|
||||
/// 订单账号(酒店唯一)
|
||||
/// </summary>
|
||||
public string accnt { get; set; }
|
||||
|
||||
public string groupid { get; set; }
|
||||
public string name { get; set; }
|
||||
public Dictionary<string, string> original { get; set; }
|
||||
public extrasData extras { get; set; }
|
||||
}
|
||||
public class originalData
|
||||
{
|
||||
//public string name { get; set; }
|
||||
//public string mobile { get; set; }
|
||||
//public string roomno { get; set; }
|
||||
//public string type { get; set; }
|
||||
//public string rtc { get; set; }
|
||||
//public string rmnum { get; set; }
|
||||
//public string sta { get; set; }
|
||||
}
|
||||
// "arr":"1750586400000",
|
||||
// "rtc":"CPC",
|
||||
// "sta":"R",
|
||||
// "rmnum":"1",
|
||||
// "roomno":"",
|
||||
// "mobile":"1212345678",
|
||||
// "name":"李二",
|
||||
// "type":"CPC",
|
||||
// "dep":"1750651200000"
|
||||
public class extrasData
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string mobile { get; set; }
|
||||
/// <summary>
|
||||
/// 房间号
|
||||
/// </summary>
|
||||
public string roomno { get; set; }
|
||||
public string type { get; set; }
|
||||
public string rtc { get; set; }
|
||||
public string rmnum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单状态
|
||||
///Q:问询
|
||||
///X:取消预订
|
||||
///N:noshow
|
||||
///R:预订
|
||||
///I:在住
|
||||
///O:本日结账
|
||||
///S:挂账退房
|
||||
///D:昨日结账
|
||||
///H:历史订单
|
||||
/// </summary>
|
||||
public string sta { get; set; }
|
||||
public string arr { get; set; }
|
||||
public string dep { get; set; }
|
||||
}
|
||||
internal class Program
|
||||
{
|
||||
public static long GetCurrentTimeStamp(DateTime dt)
|
||||
{
|
||||
TimeSpan ts = dt - new DateTime(1970, 1, 1, 8, 0, 0, DateTimeKind.Local);
|
||||
long current_timestamp = Convert.ToInt64(ts.TotalSeconds);
|
||||
return current_timestamp;
|
||||
}
|
||||
public class PMSDataBase
|
||||
{
|
||||
public string hotel_code { get; set; } = "";
|
||||
public string time { get; set; } = "";
|
||||
public string sign { get; set; } = "";
|
||||
public string hotel_id { get; set; } = "";
|
||||
public string order_no { get; set; } = "";
|
||||
public string room_no { get; set; } = "";
|
||||
public string check_out_original { get; set; }
|
||||
}
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
var DQQQ = File.ReadAllText("1.txt");
|
||||
|
||||
|
||||
|
||||
//<items><item customer="安赞同" idcard="2110**********222X" sex="女" country="0" checkindate="2025-06-19 16:26:14" checkoutdate="2025-06-20 12:00:00"/></items>
|
||||
|
||||
XDocument doc32 = XDocument.Parse(DQQQ);
|
||||
XElement Root1 = doc32.Root;
|
||||
string orderno = Root1.Attribute("orderno")?.Value;
|
||||
string cost = Root1.Attribute("cost")?.Value;
|
||||
|
||||
//是否有早餐
|
||||
string breakfast = Root1.Attribute("breakfast")?.Value;
|
||||
//押金
|
||||
string deposit = Root1.Attribute("deposit")?.Value;
|
||||
|
||||
var LESuuu = Root1.Elements("item");
|
||||
|
||||
|
||||
|
||||
|
||||
var NNNjkl = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, object>>>(DQQQ);
|
||||
PMSDataBase data = new PMSDataBase()
|
||||
{
|
||||
hotel_code = "2079",
|
||||
time = "1751426235",
|
||||
sign = "a68b2596ce7c1ca970e82a00626c16e3",
|
||||
hotel_id = "1101",
|
||||
order_no = "",
|
||||
room_no = "1102",
|
||||
check_out_original = ""
|
||||
};
|
||||
|
||||
string BaseURL = "https://f.blv-oa.com:8099/rcu_pms_api/v1";
|
||||
var client123 = new RestClient(BaseURL);
|
||||
var request123 = new RestRequest("/order/checkOut", Method.POST);
|
||||
request123.AddJsonBody(data);
|
||||
var Response = client123.Execute(request123).Content;
|
||||
string content12345 = Response;
|
||||
|
||||
|
||||
long lllhhh = GetCurrentTimeStamp(DateTime.Now);
|
||||
decimal DDD = Convert.ToDecimal(32432423.34343);
|
||||
decimal lll = DDD / 1024;
|
||||
decimal a = Math.Round(lll, 2);
|
||||
Console.WriteLine("aaaaaaaaaaaa");
|
||||
|
||||
string content = "";
|
||||
|
||||
|
||||
string PPP = File.ReadAllText("3.txt");
|
||||
byte[] photo = Tools.HEXString2ByteArray(PPP);
|
||||
|
||||
//分辨率 判断
|
||||
using (var ms = new MemoryStream(photo))
|
||||
{
|
||||
ms.Write(photo, 0, photo.Length);
|
||||
using (System.Drawing.Image image = System.Drawing.Image.FromStream(ms, false, false)) // 不加载图像数据
|
||||
{
|
||||
bool bf = image.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||
Console.WriteLine(image.Height);
|
||||
Console.WriteLine(image.Width);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
string sss111 = File.ReadAllText("3.txt");
|
||||
var OOO = JsonConvert.DeserializeObject<XMSData>(sss111);
|
||||
string Url111 = "http://pms.boonlive-rcu.com:8989";
|
||||
var client1 = new RestClient(Url111);
|
||||
//var request1 = new RestRequest("api/XMSOrderPush?xrsecret=Ip202rSR132zJGKH", Method.POST);
|
||||
var request1 = new RestRequest("api/XMSOrderPush", Method.POST);
|
||||
request1.AddQueryParameter("xrsecret", "Ip202rSR132zJGKH");
|
||||
request1.AddJsonBody(OOO);
|
||||
var response = client1.Execute(request1);
|
||||
var content111 = response.Content;
|
||||
|
||||
|
||||
|
||||
////string url = "http://face.blv-oa.com/Interface/checkinInterface?key=abc&data={"LodgerNmae":"王悦","IDNumber":"1133397752487743488","Sex":0,"picture":"http://pms.boonlive-rcu.com:89/pic/1133397752487743488_1384391.jpg","HotelCode":"2079","roomid":"1906","phonenumber":"19847388255","CheckTime":"2025-06-20 11:19:04","pmsinfoid":1905524}";
|
||||
//string url = File.ReadAllText("2.txt");
|
||||
//var NNN1= JsonConvert.DeserializeObject<portinfo>(url);
|
||||
|
||||
//return;
|
||||
//var client1 = new RestClient(url);
|
||||
//var request1 = new RestRequest(Method.POST);
|
||||
//request1.AddJsonBody(null);
|
||||
//var Response = client1.Execute(request1).Content;
|
||||
//content = Response;
|
||||
|
||||
//string result = string.Empty;
|
||||
//HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
|
||||
//req.ContentType = "application/json";
|
||||
//req.Method = "POST";
|
||||
////req.Timeout = 10000;//设置请求超时时间,单位为毫秒
|
||||
//byte[] data = Encoding.UTF8.GetBytes("");
|
||||
//req.ContentLength = data.Length;
|
||||
//using (Stream reqStream = req.GetRequestStream())
|
||||
//{
|
||||
// reqStream.Write(data, 0, data.Length);
|
||||
//}
|
||||
//HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
|
||||
//using (Stream stream = resp.GetResponseStream())
|
||||
//{
|
||||
// using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
|
||||
// {
|
||||
// result = reader.ReadToEnd();//获取响应内容
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
Console.ReadKey();
|
||||
|
||||
|
||||
string xmlString = File.ReadAllText("1.txt");
|
||||
XDocument doc1 = XDocument.Parse(xmlString);
|
||||
XElement Root = doc1.Root;
|
||||
string NNN = Root.Attribute("orderno")?.Value;
|
||||
|
||||
var LES = Root.Elements("item");
|
||||
foreach (var item in LES)
|
||||
{
|
||||
string customer = item.Attribute("customer").Value;
|
||||
string sex = item.Attribute("sex").Value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//ServiceReference1.blwwsSoapClient c = new ServiceReference1.blwwsSoapClient();
|
||||
//c.Test();
|
||||
//string token = GetToken_G();
|
||||
//Console.WriteLine(token);
|
||||
//ConcurrentDictionary<string, string> GlobalData = new ConcurrentDictionary<string, string>();
|
||||
//GlobalData.AddOrUpdate("A", token, (k, v) => { return token; });
|
||||
//GlobalData.AddOrUpdate("A", token, (k, v) => { return token; });
|
||||
//GlobalData.AddOrUpdate("A", token, (k, v) => { return token; });
|
||||
//GlobalData.AddOrUpdate("A", token, (k, v) => { return token; });
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
static public string UserCode = "KKJK";
|
||||
static public string UserKey = "KKJK0428";
|
||||
static public string BaseUrl = "https://armitage-ipms.shijicloud.com";
|
||||
public static string GetToken_G()
|
||||
{
|
||||
Dictionary<string, string> Params = new Dictionary<string, string>();
|
||||
Params.Add("userCode", UserCode);
|
||||
Params.Add("key", UserKey);
|
||||
|
||||
var tokenstr = Send_Http_Request_Params("/iPMSAPI/iPMSApiService/api/applySecurityToken", Params);
|
||||
|
||||
Console.WriteLine(tokenstr);
|
||||
if (!string.IsNullOrEmpty(tokenstr))
|
||||
{
|
||||
var dic = JsonConvert.DeserializeObject<Dictionary<string, string>>(tokenstr);
|
||||
string token = dic["securityToken"];
|
||||
return token;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static string Send_Http_Request_Params(string Url, Dictionary<string, string> Params)
|
||||
{
|
||||
var client1 = new RestClient(BaseUrl);
|
||||
var request1 = new RestRequest(Url, Method.POST);
|
||||
|
||||
foreach (KeyValuePair<string, string> item in Params)
|
||||
{
|
||||
request1.AddParameter(item.Key, item.Value);
|
||||
}
|
||||
|
||||
var response = client1.Execute(request1);
|
||||
var content = response.Content;
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
public static string queueName2 = @".\private$\faceServerToWeb";
|
||||
public static MessageQueue mq2 = null;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 从消息队列中读取命令,并执行
|
||||
/// </summary>
|
||||
public static void ReceiveCmdLoop()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
//判断队列是否存在
|
||||
if (MessageQueue.Exists(queueName2))
|
||||
{
|
||||
mq2 = new MessageQueue(queueName2);
|
||||
}
|
||||
else
|
||||
{
|
||||
//创建队列
|
||||
mq2 = MessageQueue.Create(queueName2);
|
||||
}
|
||||
//给管理员队列权力
|
||||
mq2.SetPermissions("Administrator", MessageQueueAccessRights.FullControl);
|
||||
//匿名登录
|
||||
mq2.SetPermissions("ANONYMOUS LOGON", MessageQueueAccessRights.FullControl);
|
||||
mq2.SetPermissions("Everyone", MessageQueueAccessRights.FullControl);
|
||||
|
||||
while (true)
|
||||
{
|
||||
Message msgRx = mq2.Receive();
|
||||
msgRx.Formatter = new XmlMessageFormatter(new Type[] { typeof(string) });
|
||||
|
||||
string strRx = msgRx.Body.ToString();
|
||||
|
||||
|
||||
Thread.Sleep(1300); //阻塞当前线程1秒,让其他线程运行
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Thread.Sleep(5000); //阻塞当前线程5秒,再重新启动
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 向消息队列中发送消息
|
||||
/// </summary>
|
||||
/// <param name="sendMsg">消息</param>
|
||||
/// <returns></returns>
|
||||
public static string QueueSend(string sendMsg)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (mq2 == null)
|
||||
{
|
||||
if (MessageQueue.Exists(queueName2))
|
||||
{
|
||||
mq2 = new MessageQueue(queueName2);
|
||||
}
|
||||
else
|
||||
{
|
||||
mq2 = MessageQueue.Create(queueName2);
|
||||
}
|
||||
mq2.SetPermissions("Administrator", MessageQueueAccessRights.FullControl);
|
||||
mq2.SetPermissions("ANONYMOUS LOGON", MessageQueueAccessRights.FullControl);
|
||||
mq2.SetPermissions("Everyone", MessageQueueAccessRights.FullControl);
|
||||
}
|
||||
|
||||
Message msgTx = new Message
|
||||
{
|
||||
Body = "",
|
||||
Formatter = new XmlMessageFormatter(new Type[] { typeof(string) })
|
||||
};
|
||||
mq2.Send(msgTx);
|
||||
return "Succeed push msg to MQ !";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
mq2 = null;
|
||||
return ex.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user