初始化

This commit is contained in:
2025-11-25 17:41:24 +08:00
commit 4cdf0f0f85
3383 changed files with 1050962 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class CheckInfo
{
public string idtype { get; set; }
public string idcard { get; set; }
public string customer { get; set; }
public string sex { get; set; }
public string country { get; set; }
public string checkindate { get; set; }
}
}

View File

@@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class Condition
{
/// <summary>
/// 酒店ID
/// </summary>
public int HotelID { get; set; }
/// <summary>
/// 是否绑定绑定房间
/// </summary>
public int Notbing { get; set; }
/// <summary>
/// 人脸机状态
/// </summary>
public int Status { get; set; }
/// <summary>
/// 人脸机名称
/// </summary>
public string FaceName { get; set; }
/// <summary>
/// 页数据最大
/// </summary>
public int dataMax { get; set; }
/// <summary>
/// 页数据最小
/// </summary>
public int dataMin { get; set; }
/// <summary>
/// 页
/// </summary>
public int Pages { get; set; }
/// <summary>
/// 房间状态
/// </summary>
public int RoomStatus { get; set; }
/// <summary>
/// 时间
/// </summary>
public DateTime RoomDate { get; set; }
/// <summary>
/// 时间
/// </summary>
public DateTime RoomMinDate { get; set; }
/// <summary>
/// 时间
/// </summary>
public DateTime RoomMaxDate { get; set; }
/// <summary>
/// 房间号
/// </summary>
public string RoomName { get; set; }
public int filetype { get; set; } //1 升级文件 2 Logo 3背景图
public int roomid { get; set; }
// 默认不看进入S8状态的
public int showS8 { get; set; }
}
}

View File

@@ -0,0 +1,381 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WebSocketToolsConsole
{
public class Entity
{
public enum Factory
{
= 0,
= 1,
= 2
}
public class Rootinfo
{
public int pmsid { get; set; }
public msgx msgx { get; set; }
}
/// <summary>
/// 实义德人脸机传输数据类型
/// </summary>
public class msgx
{
/// <summary>
/// 消息ID
/// </summary>
public string msgid { get; set; }
/// <summary>
/// 终端序列号
/// </summary>
public string sn { get; set; }
/// <summary>
/// 消息类型: setPerson/removePerson、open/reboot开门重启
/// </summary>
public string cmd { get; set; }
/// <summary>
/// 消息主体Content-Type: application/x-www-formurlencoded
/// </summary>
public string msg { get; set; }
}
/// <summary>
/// 实义德人脸机返回结果
/// </summary>
public class msgx_response_msg
{
/// <summary>
/// 状态码0-成功,其他状态见状态码表
/// </summary>
public int status { get; set; }
/// <summary>
/// 状态描述:状态码的详细描述,比如:成功
/// </summary>
public string msg { get; set; }
/// <summary>
/// 返回数据返回请求的数据比如请求人员列表则data即为人员列表的json字符串
/// </summary>
public string data { get; set; }
}
/// <summary>
/// 实义德人脸机过闸人员结构
/// </summary>
public class msgx_person
{
/// <summary>
/// 秘钥:终端设备的秘钥
/// </summary>
public string key { get; set; }
/// <summary>
/// 人员IDID,验证人员唯一性的字段,必填
/// </summary>
public string id { get; set; }
/// <summary>
/// 人员的名字
/// </summary>
public string name { get; set; }
/// <summary>
/// 卡号:作为维根号发送到闸机
/// </summary>
public string IC_NO { get; set; }
/// <summary>
/// 身份证号
/// </summary>
public string ID_NO { get; set; }
/// <summary>
/// 照片JPG头像照片要求宽高640x480像素转为Base64字符串传输JPG 分辨率最大支持1080x1080
/// </summary>
public string photo { get; set; }
/// <summary>
/// 最大过闸次数:一共可以过闸的最大次数[0,10000);当此值设置等于10000时代表可以无限次过闸,默认:10000
/// </summary>
public long passCount { get; set; }
/// <summary>
/// 起始时间:此时间之后拥有过闸权限,单位:秒(传-1表示无限制),默认无限制
/// </summary>
public double startTs { get; set; }
/// <summary>
/// 截止时间:此时间之后无过闸权限,单位:秒(传-1表示无限制),默认无限制
/// </summary>
public double endTs { get; set; }
/// <summary>
/// 访客true-是访客false-非访客默认false
/// </summary>
public bool visitor { get; set; }
/// <summary>
/// 以周为单位设置每 天不同的时间段:有权限过闸多个时间段,可以周为单位设置每 天不同的时间段,也可以设置每天相同的时间 段,不支持进行缺省设置(时间段格式: “09:00-12:35”不同时间段间用“;”分割)
/// </summary>
public string weekly { get; set; }
}
/// <summary>
/// 人员添加
/// </summary>
public class SavePersonRequest
{
/// <summary>
/// ID编号回复id编号成对出现,用来关联平台的发送和设备的回复
/// </summary>
public int id { get; set; }
/// <summary>
/// 方法personnelData.savePersons
/// </summary>
public string method { get; set; }
/// <summary>
/// 人员信息列表
/// </summary>
public List<Params> @params { get; set; }
}
/// <summary>
/// 人员信息列表
/// </summary>
public class Params
{
/// <summary>
/// 人员信息
/// </summary>
public Person Person { get; set; }
}
/// <summary>
/// 人员信息
/// </summary>
public class Person
{
/// <summary>
/// 人员类型,1-内部员工,2-访客, 3-黑名单;必填
/// </summary>
public int Type { get; set; }
/// <summary>
/// 证件号,与CertificateType组合构成全局唯一人员标识,不允许更新,避免前端和平台端不一致。必填
/// </summary>
public string Code { get; set; }
/// <summary>
/// 默认权限组。必填
/// </summary>
public string GroupName { get; set; }
/// <summary>
/// 姓名必填
/// </summary>
public string Name { get; set; }
/// <summary>
/// 性别必填
/// </summary>
public string Sex { get; set; }
/// <summary>
/// 出生日期必填
/// </summary>
public string Birthday { get; set; }
/// <summary>
/// 访客信息,人员类型是访客时有效(非访客不填)
/// </summary>
public GuestInfo GuestInfo { get; set; }
/// <summary>
/// 通过HTTP协议下载图片的地址只支持JPG格式;
/// </summary>
public string URL { get; set; }
/// <summary>
/// Base64编码的图片数据,与URL字段互斥 base64数据不用带上格式信息如【data:image/jpg;base64,】
/// </summary>
public string Images { get; set; }
/// <summary>
/// 卡信息
/// </summary>
public Cards Cards { get; set; }
}
/// <summary>
/// 访客信息,人员类型是访客时有效(非访客不填)
/// </summary>
public class GuestInfo
{
/// <summary>
/// 单位
/// </summary>
public string Corp { get; set; }
/// <summary>
/// 电话
/// </summary>
public string Phone { get; set; }
/// <summary>
/// 车牌号码
/// </summary>
public string CarLicense { get; set; }
/// <summary>
/// 随行人数
/// </summary>
public int Partner { get; set; }
/// <summary>
/// 被访人
/// </summary>
public string Host { get; set; }
/// <summary>
/// 准入时间
/// </summary>
public AccessTime AccessTime { get; set; }
}
/// <summary>
/// 准入时间
/// </summary>
public class AccessTime
{
/// <summary>
/// 开始时间
/// </summary>
public string from { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public string to { get; set; }
}
/// <summary>
/// 卡信息
/// </summary>
public class Cards
{
/// <summary>
/// 卡号
/// </summary>
public string ID { get; set; }
/// <summary>
/// 卡类型1普通卡2胁迫卡
/// </summary>
public int Type { get; set; }
/// <summary>
/// 有效期日期开始日期yyyy-MM-dd结束日期yyyy-MM-dd
/// </summary>
public string[] Validity { get; set; }
/// <summary>
/// 有效期时间默认00:00:0023:59:59开始时间HH:mm:ss结束时间HH:mm:ss
/// </summary>
public string[] ValidityTime { get; set; }
public Memo Memo { get; set; }
}
/// <summary>
/// optional其他信息
/// </summary>
public class Memo
{
/// <summary>
/// 门禁位置
/// </summary>
public string Entrance { get; set; }
}
/// <summary>
/// 人员添加设备回应
/// </summary>
public class Response
{
/// <summary>
/// ID编号回复id编号成对出现,用来关联平台的发送和设备的回复
/// </summary>
public int id { get; set; }
/// <summary>
/// 方法personnelData.savePersons,removePersons
/// </summary>
public string method { get; set; }
/// <summary>
/// 返回结果
/// </summary>
public bool result { get; set; }
/// <summary>
/// 人员信息列表
/// </summary>
public List<ParamsResponse> @params { get; set; }
}
/// <summary>
/// 响应人员信息
/// </summary>
public class ParamsResponse
{
/// <summary>
/// 人员类型,1-内部员工,2-访客, 3-黑名单
/// </summary>
//public string CertificateType { get; set; }
/// <summary>
/// 证件号,与CertificateType组合构成全局唯一人员标识,不允许更新,避免前端和平台端不一致
/// </summary>
public string Code { get; set; }
/// <summary>
/// 当前人员是否添加成功,失败有错误码和错误信息
/// </summary>
public bool Result { get; set; }
/// <summary>
/// 错误码
/// </summary>
public int ErrorCode { get; set; }
/// <summary>
///
/// </summary>
//public string[] ErrorCodePic { get; set; }
/// <summary>
/// 错误信息
/// </summary>
//public string ErrorMessage { get; set; }
}
/// <summary>
/// 人员删除
/// </summary>
public class RemovePersonRequest
{
/// <summary>
/// ID编号回复id编号成对出现,用来关联平台的发送和设备的回复
/// </summary>
public int id { get; set; }
/// <summary>
/// 方法personnelData.removePersons
/// </summary>
public string method { get; set; }
/// <summary>
/// 人员信息列表
/// </summary>
public List<RemoveParams> @params { get; set; }
}
/// <summary>
/// 人员信息列表
/// </summary>
public class RemoveParams
{
public string Code { get; set; }
}
/// <summary>
/// 人员删除设备回应
/// </summary>
//public class RemovePersonResponse
//{
// /// <summary>
// /// ID编号回复id编号成对出现,用来关联平台的发送和设备的回复
// /// </summary>
// public int id { get; set; }
// /// <summary>
// /// 方法personnelData.removePersons
// /// </summary>
// public string method { get; set; }
// /// <summary>
// /// 返回结果
// /// </summary>
// public bool result { get; set; }
// /// <summary>
// /// 人员信息列表
// /// </summary>
// public List<Response> @params { get; set; }
//}
/// <summary>
/// 响应人员信息
/// </summary>
//public class RemoveParamsResponse
//{
// /// <summary>
// /// 证件号,与CertificateType组合构成全局唯一人员标识,不允许更新,避免前端和平台端不一致
// /// </summary>
// public string Code { get; set; }
// /// <summary>
// /// 当前人员是否添加成功,失败有错误码和错误信息
// /// </summary>
// public bool Result { get; set; }
// /// <summary>
// /// 错误码
// /// </summary>
// public int ErrorCode { get; set; }
//}
}
}

View File

@@ -0,0 +1,123 @@
using Face.Domain.Entities;
using Face.Web.Areas.App.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Timers;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class errormessagehandling
{
public int id { get; set; }
public string ErrorNmae { get; set; }
public string pmsids { get; set; }
public string handlinginfo { get; set; }
public DateTime creationdata { get; set; }
public int isVerify { get; set; }
}
public class pmsinfo
{
public int pmsid { get; set; }
public DateTime Creationtime { get; set; }
public string data { get; set; }
public int infotype { get; set; }
public int hotelid { get; set; }
public int room { get; set; }
}
public class Errormessageinfo
{
private static int smsconts = 0;
private static string arrpmsids = "";
public void Errormessage(int pmsid,string message)
{
//检查10分钟内有没有s3s2错误的
//DateTime date = DateTime.Now.AddMinutes(-10);
//var pmsinfo = SqlSugarBase.Db.Queryable<pmsinfo>().Where(x => x.Creationtime >= date).ToList();
//List<int> arrint = new List<int>();
//for (int i = 0; i < pmsinfo.Count(); i++)
//{
// arrint.Add(pmsinfo[i].pmsid);
//}
//for (int i = 0; i < arrint.Count(); i++)
//{
// List<pmsLog> logspmssfs = SqlSugarBase.Db.Queryable<pmsLog>().Where(x => x.pmsid == arrint[i]).ToList();
// if (logspmssfs.Count() <= 3)
// {
// smsconts += 1;
// arrpmsids += arrint[i] + ",";
// }
//}
TimerElapsed();
//if (message== "已校验数据,准备向控制台发送")
//{
List<pmsLog> logspms = SqlSugarBase.Db.Queryable<pmsLog>().Where(x => x.pmsid == pmsid).ToList();
if (logspms.Count() <= 6)
{
smsconts += 1;
arrpmsids += pmsid + ",";
}
string[] strarr=arrpmsids.Split(',');
if (strarr.Length>6)
{
arrpmsids = "";
}
else
{
if (smsconts == 5)
{
errormessagehandling log = SqlSugarBase.Db.Queryable<errormessagehandling>().First(x=> arrpmsids.Contains(x.pmsids));
if (log==null)
{
Responsesd responsesd = SMSinfo.SMSNotify();
errormessagehandling errormessage = new errormessagehandling();
errormessage.ErrorNmae = "S2,S3S22或S21错误没有发送到控制台";
errormessage.handlinginfo = "发送短信,重启控制台程序";
errormessage.pmsids = arrpmsids;
errormessage.creationdata = DateTime.Now;
errormessage.isVerify = 0;
SqlSugarBase.Db.Insertable(errormessage).ExecuteCommand();
if (responsesd.SendStatusSet[0].Code == "ok" || responsesd.SendStatusSet[0].Code == "Ok")
{
smsconts = 0;
arrpmsids = "";
}
}
}
}
//}
}
public static void TimerElapsed()
{
Timer timer = new Timer();
timer.Interval = 120000; // 1000毫秒 = 1秒
timer.AutoReset = false;
//启动定时器
timer.Start();
//// 停止定时器
//timer.Stop();
}
public static void TimerElapseds()
{
Timer timer = new Timer();
timer.Interval = 12000; // 1000毫秒 = 1秒
timer.AutoReset = false;
//启动定时器
timer.Start();
//// 停止定时器
//timer.Stop();
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class FileDetails
{
public string Filename { get; set; }
public string FileSize { get; set; }
public DateTime UploadDate { get; set; }
public FileDetails(string filename, string fileSize, DateTime uploadDate)
{
Filename = filename;
FileSize = fileSize;
UploadDate = uploadDate;
}
}
}

View File

@@ -0,0 +1,56 @@
using Face.Services.Manager;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public static class GetRoomInterface
{
public static Roominfo.Root Roomport(test te)//房间api
{
try
{
string url = "https://www.boonlive-rcu.com/api/GetHostList";
string date = $"jsonData={JsonConvert.SerializeObject(te)}";
WebRequest request = WebRequest.Create(url);
request.Method = "Post";
request.ContentType = "application/x-www-form-urlencoded";
StreamWriter sw = new StreamWriter(request.GetRequestStream());
sw.Write(date);
sw.Flush();
WebResponse response = request.GetResponse();
Stream s = response.GetResponseStream();
StreamReader sr = new StreamReader(s, Encoding.GetEncoding("UTF-8"));
string Show = sr.ReadToEnd();
Roominfo.Root info = JsonConvert.DeserializeObject<Roominfo.Root>(Show);//josn转换实体类
sw.Dispose();
sw.Close();
sr.Dispose();
sr.Close();
s.Dispose();
s.Close();
return info;
}
catch (Exception ex)
{
LogHelp.WriteExceptionLog(ex);
Roominfo.Root info = new Roominfo.Root() { IsSuccess = false};//josn转换实体类
return info;
}
}
public class test
{
public string code { get; set; }
public string creatDate { get; set; }
}
}
}

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class InfoBody
{
/// <summary>
/// //ID,验证人员唯一性的字段
/// </summary>
public string id { get; set; }
/// <summary>
/// //人员的名字
/// </summary>
public string name { get; set; }
/// <summary>
/// //作为维根号发送到闸机
/// </summary>
public string ic_no { get; set; }
/// <summary>
/// //员工身份证号
/// </summary>
public string id_no { get; set; }
/// <summary>
/// //JPG头像照片要求宽高640x480像素转为Base64字符串传输最大支持1080x1080
/// </summary>
public string photo { get; set; }
/// <summary>
/// 起始时间
/// </summary>
public string startTs { get; set; }
/// <summary>
/// 截止时间
/// </summary>
public string endTs { get; set; }
/// <summary>
/// //在有效时间戳内最大过闸次数。当此值设置等于10000时代表可以无限次过闸,默认:10000
/// </summary>
public string passCount { get; set; }
/// <summary>
/// //true-是访客false-非访客默认false兼容以前协议
/// </summary>
public string visitor { get; set; }
/// <summary>
/// 以周为单位设置每 天不同的时间段
/// </summary>
public string weekly { get; set; }
}
}

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class InfoRoomall
{
/// <summary>
/// //房间ID,内部数据库主键
/// </summary>
public string InnerRoomId { get; set; }
/// <summary>
/// //酒店的ID内部数据库主键
/// </summary>
public string HotelId { get; set; }
/// <summary>
/// //酒店名字
/// </summary>
public string HotelName { get; set; }
/// <summary>
/// //酒店编码
/// </summary>
public string ExternalHotelCode { get; set; }
/// <summary>
/// //房间号码
/// </summary>
public string RoomNumber { get; set; }
/// <summary>
/// //开房状态
/// </summary>
public int RoomCheckInStatus { get; set; }
public int Facelid { get; set; }
public string SerialNo { get; set; }
public Nullable<System.DateTime> CreatedDate { get; set; }
public string HotelCode { get; set; }
public Nullable<int> RoomId { get; set; }
public string Factory { get; set; }
public bool Status { get; set; }
public Nullable<System.DateTime> bindingDate { get; set; }
public bool bindingStatus { get; set; }
public string faceIp { get; set; }
public string faceAddress { get; set; }
public Nullable<int> maintainStatus { get; set; }
}
}

View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class Interfacefield
{
/// <summary>
/// 名称
/// </summary>
public string LodgerNmae { get; set; }
/// <summary>
/// 身份证
/// </summary>
public string IDNumber { get; set; }
/// <summary>
/// 性别 0女 1男
/// </summary>
public int Sex { get; set; }
/// <summary>
/// 图片
/// </summary>
public string picture { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { 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; }
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class ProgramViewModel
{
public string ProgramPath { get; set; }
public string ProgramName { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
enum Statiss
{
/// <summary>
/// 出租
/// </summary>
lease,
/// <summary>
/// 待租
/// </summary>
forRent,
/// <summary>
/// 退房
/// </summary>
checkout,
/// <summary>
/// 空房
/// </summary>
vacantroom
}
}

View File

@@ -0,0 +1,142 @@
using Face.Domain.Entities;
using Face.Services.Manager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebServer;
using static Face.Services.Cache.CacheHelp;
using static Face.Web.Areas.App.Models.Roominfo;
namespace Face.Web.Areas.App.Models
{
public class Roominfo
{
public class Result
{
/// <summary>
///
/// </summary>
public int ID { get; set; }
/// <summary>
///
/// </summary>
public string HostNumber { get; set; }
/// <summary>
///
/// </summary>
public string RoomNumber { get; set; }
/// <summary>
///
/// </summary>
public DateTime RegisterDate { get; set; }
/// <summary>
///
/// </summary>
public int RoomStatusID { get; set; }
/// <summary>
/// 空房
/// </summary>
public string RoomStatusName { get; set; }
/// <summary>
///
/// </summary>
public int RoomTypeID { get; set; }
/// <summary>
///
/// </summary>
public string RoomTypeName { get; set; }
/// <summary>
///
/// </summary>
public string MAC { get; set; }
/// <summary>
///
/// </summary>
public string IP { get; set; } = null;
/// <summary>
///
/// </summary>
public string Remark { get; set; }
public string HotelID { get; set; }
}
public class Root
{
/// <summary>
///
/// </summary>
public bool IsSuccess { get; set; }
/// <summary>
///
/// </summary>
public List<Result> Result { get; set; }
}
}
public class FJHelp
{
public static bool outinfos(string id)//退房信息
{
List<Result> relist = null;
CheckinTest sun;
try
{
using (var db = SqlSugarBase.GesmartDb())
{
int dtid = int.Parse(id);
sun = db.Queryable<CheckinTest>().First(x => x.id == dtid);
}
var hotelcode = SqlSugarBase.authoriydb.Queryable<Hotels>().First(x => x.Id == sun.hotelid);
var idi = int.Parse(sun.Roomid.ToString());
GetRoomInterface.test test = new GetRoomInterface.test
{
code = hotelcode.Code.ToString(),
creatDate = hotelcode.CreateTime.ToString("yyyy-MM-dd")
};
Roominfo.Root asd = GetRoomInterface.Roomport(test);
if (asd.IsSuccess == true)
{
relist = asd.Result;
}
var roomname = relist.FirstOrDefault(x => x.ID == idi).RoomNumber;
bool fp = outinfo(new OutClass { HotelCode = hotelcode.Code.ToString(), roomid = roomname, checkOutTime = DateTime.Now });
if (fp)
{
SqlSugarBase.Db.Updateable<CheckinTest>().SetColumns(it => it.testState == 2).Where(x => x.id == sun.id).ExecuteCommand();
SqlSugarBase.Db.Updateable<CheckinTest>().SetColumns(it => it.CheckoutTime == DateTime.Now).Where(x => x.id == sun.id).ExecuteCommand();
}
else
{
SqlSugarBase.Db.Updateable<CheckinTest>().SetColumns(it => it.testState ==3).Where(x => x.id == sun.id).ExecuteCommand();
//.Entry<CheckinTest>(sun).State = EntityState.Modified;
}
return fp ;
}
catch (Exception ex)
{
LogHelp.WriteExceptionLog(ex);
return false;
}
}
public static bool outinfo(OutClass po)//退房测试
{
try
{
var whether = WebHelp.CheckOut(new CheckOutInfo { code = po.HotelCode, roomNumber = po.roomid });
return whether;
}
catch (Exception ex)
{
LogHelp.WriteExceptionLog(ex);
throw;
}
}
}
}

View File

@@ -0,0 +1,183 @@
using Face.Domain.Entities;
using Face.Services.Extensions;
using Face.Services.Manager;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Web;
using WebSocketToolsConsole;
using System.Messaging;
namespace Face.Web.Areas.App.Models
{
public static class UdpCommunication
{
static object lockobject = new object();
public static UdpClient client = null;
public static IPEndPoint remotePoint = null;
public static UdpClient client1 = null;
public static IPEndPoint remotePoint1 = null;
//Queue for send message to console web socket server.
public static string queueName = @".\private$\facesvrcmd";
public static MessageQueue mq = null;
/// <summary>
/// UDP传输发送数据到控制台
/// </summary>
/// <param name="str"></param>
public static void UdpState(string str)
{
//Logs.WriteLog(str);
try
{
byte[] sendData = null;//要发送的字节数组
//IPAddress remoteIP = IPAddress.Parse("172.30.53.136");
IPAddress remoteIP = IPAddress.Parse("127.0.0.1");
int remotePort = 11001;
remotePoint = new IPEndPoint(remoteIP, remotePort);//实例化一个远程端点
sendData = Encoding.Default.GetBytes(str);
client = new UdpClient();
client.Send(sendData, sendData.Length, remotePoint);//将数据发送到远程端点
}
catch (Exception ex)
{
throw new CustomException(ex.Message);
}
//client.Close();//关闭连接
}
/// <summary>
/// 接收控制台返回数据
/// </summary>
public static void UdpStateinfo()
{
Entity.msgx msgx = new Entity.msgx();
while (true)
{
try
{
string receiveString = null;
byte[] receiveData = null;
//IPEndPoint remotePoint = new IPEndPoint(IPAddress.Any, 0);
//client.Client.ReceiveTimeout = 500;
//client.Client.Blocking = false; //设置为非阻塞模式
receiveData = client.Receive(ref remotePoint);//接收数据
receiveString = Encoding.Default.GetString(receiveData);
Entity.msgx Elist = JsonConvert.DeserializeObject<Entity.msgx>(receiveString);//josn转换实体类
using (var dr=SqlSugarBase.GesmartDb())
{
transferFace sx = dr.Queryable<transferFace>().First(x=>x.infoid==Elist.msgid);
sx.faultState = int.Parse(Elist.cmd);
FaceIssue issue = dr.Queryable<FaceIssue>().First(x => x.messageid == Elist.msgid);
if (Elist.cmd == "2")
{
issue.issuestate = 2;
var assed = dr.Queryable<DeviceManage>().First(x=>x.SerialNo==sx.faceSN);
SqlSugarBase.Db.Updateable<DeviceManage>().SetColumns(it => it.maintainStatus == 1).Where(it => it.SerialNo == sx.faceSN).ExecuteCommand();
SqlSugarBase.Db.Updateable<FaceIssue>().SetColumns(it => it.issuestate ==2).Where(x => x.messageid == Elist.msgid).ExecuteCommand();
}
SqlSugarBase.Db.Updateable<transferFace>().SetColumns(it => it.faultState == int.Parse(Elist.cmd)).Where(x => x.infoid == Elist.msgid).ExecuteCommand();
}
//client.Close();//关闭连接
}
catch (Exception ex)
{
//Logs.WriteTimingPlanLog(ex.ToString());
}
}
}
public static void UdpState2(string str)
{
try
{
byte[] sendData = null;//要发送的字节数组
IPAddress remoteIP = IPAddress.Parse("172.30.53.136");
int remotePort = 11002;
remotePoint1 = new IPEndPoint(remoteIP, remotePort);//实例化一个远程端点
sendData = Encoding.Default.GetBytes(str);
client1 = new UdpClient();
client1.Send(sendData, sendData.Length, remotePoint1);//将数据发送到远程端点
}
catch (Exception ex)
{
throw new CustomException(ex.Message);
throw;
}
//client.Close();//关闭连接
}
//public static string UdpStateinfo2()
//{
// Entity.msgx msgx = new Entity.msgx();
// while (true)
// {
// try
// {
// string receiveString = null;
// byte[] receiveData = null;
// //IPEndPoint remotePoint = new IPEndPoint(IPAddress.Any, 0);
// //client.Client.ReceiveTimeout = 500;
// //client.Client.Blocking = false; //设置为非阻塞模式
// receiveData = client1.Receive(ref remotePoint1);//接收数据
// receiveString = Encoding.Default.GetString(receiveData);
// //Entity.msgx_person Elist = JsonConvert.DeserializeObject<Entity.msgx_person>(receiveString);//josn转换实体类
// //Logs.WriteLog(receiveString);
// return receiveString;
// //client.Close();//关闭连接
// }
// catch (Exception ex)
// {
// //Logs.WriteTimingPlanLog(ex.ToString());
// //throw new CustomException(ex.Message);
// }
// }
//}
public static string QueueSend(string sendMsg)
{
try
{
if (mq == null)
{
if (MessageQueue.Exists(queueName))
{
mq = new MessageQueue(queueName);
}
else
{
mq = MessageQueue.Create(queueName);
}
mq.SetPermissions("Administrator", MessageQueueAccessRights.FullControl);
mq.SetPermissions("ANONYMOUS LOGON", MessageQueueAccessRights.FullControl);
mq.SetPermissions("Everyone", MessageQueueAccessRights.FullControl);
}
Message msgTx = new Message();
msgTx.Body = sendMsg;
msgTx.Formatter = new XmlMessageFormatter(new Type[] { typeof(string) });
mq.Send(msgTx);
return "Succeed push msg to MQ !";
}
catch (Exception ex)
{
mq = null;
Logs.WriteErrorLog(ex);
return ex.ToString();
}
}
}
}

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class UiImg
{
public string name;
public string image;
public int x;
public int y;
public int w;
public int h;
}
public class Uiinfo
{
public string Roomname;
public string imageBj;
public string imagelogo;
}
}

View File

@@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class Userinfo
{
/// <summary>
///
/// </summary>
public string HeadImg { get; set; }
public string Uid { get; set; }
}
public class AuthItem
{
/// <summary>
///
/// </summary>
public int AuthotypeId { get; set; }
/// <summary>
///
/// </summary>
public int AuthorityId { get; set; }
/// <summary>
/// 分配酒店
/// </summary>
public string AuthorityName { get; set; }
}
public class HotelsItem
{
/// <summary>
///
/// </summary>
public List<AuthItem> Auth { get; set; }
/// <summary>
/// 默认酒店
/// </summary>
public string HotelName { get; set; }
/// <summary>
///
/// </summary>
public int Code { get; set; }
/// <summary>
///
/// </summary>
public int HotelId { get; set; }
}
public class HotelDataItem
{
/// <summary>
/// 宝来威
/// </summary>
public string HotelGroupsName { get; set; }
/// <summary>
///
/// </summary>
public int HotelGroupsId { get; set; }
/// <summary>
///
/// </summary>
public List<HotelsItem> Hotels { get; set; }
}
public class Data
{
/// <summary>
///
/// </summary>
public Userinfo Userinfo { get; set; }
/// <summary>
///
/// </summary>
public List<HotelDataItem> HotelData { get; set; }
}
public class Root
{
/// <summary>
///
/// </summary>
public Data Data { get; set; }
/// <summary>
///
/// </summary>
public int Status { get; set; }
/// <summary>
/// 请求成功~
/// </summary>
public string Message { get; set; }
}
}

View File

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public static class peopleInfo
{
/// <summary>
/// 证件类型
/// </summary>
public static string idtype { get; set; }
/// <summary>
/// 身份证号码
/// </summary>
public static string idcard { get; set; }
/// <summary>
/// 顾客名字
/// </summary>
public static string customer { get; set; }
/// <summary>
/// 性别
/// </summary>
public static string sex { get; set; }
/// <summary>
/// 国家
/// </summary>
public static string country { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public static string checkindate { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using Face.Domain.Application;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using static Face.Web.Areas.App.Models.Roominfo;
namespace Face.Web.Areas.App.Models
{
public static class permissionStatic
{
public static List<int> lit = new List<int>();
public static string Portraits { get; set; }
public static List<TBL_ROOM_BASIC_INFO> ZongRoominfo = new List<TBL_ROOM_BASIC_INFO>();
}
}

View File

@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
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; }
}
}

View File

@@ -0,0 +1,226 @@
using Face.Domain.ViewModels;
using Face.Services.Manager;
using Face.Web.Areas.App.Controllers;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using System.Web;
using ImageMagick;
using System.Web.Hosting;
using static WebSocketToolsConsole.Entity;
namespace Face.Web.Areas.App.Models
{
/// <summary>
/// 图片处理类
/// </summary>
public class practical
{
/// <summary>
/// 网络图片保存到项目目录
/// </summary>
/// <param name="url"></param>
/// <param name="dtnow"></param>
public string Down(string url, string dtnow)
{
try
{
WebRequest wreq = WebRequest.Create(url);
HttpWebResponse wresp = (HttpWebResponse)wreq.GetResponse();
Stream s = wresp.GetResponseStream();
System.Drawing.Image img;
img = System.Drawing.Image.FromStream(s);
string TimePath = HostingEnvironment.MapPath("~/Upload/Image/");//保存路径
string TimePathMake = HostingEnvironment.MapPath("~/Upload/Img/");//小图
img.Save(TimePath + dtnow + "_1" + ".jpg", ImageFormat.Jpeg);
Task<string> res = MakeThumbnail(img, TimePathMake, 500, 500, "", dtnow);
//System.IO.File.Delete(TimePath + "1" + name + ".jpg");
res.Start();
//MemoryStream ms = new MemoryStream();
img.Dispose();
string ftpURL = "auth.blv-oa.com:50/uts_Manager/oyl_FTP/Image";
//string ftpURLTwo = "auth.blv-oa.com:50/uts_Manager/oyl_FTP/Img";
//FtpUploadShow(TimePathMake + dtnow + ".jpg", ftpURLTwo);
return FtpUploadShow(res.Result, ftpURL);
}
catch (Exception ex)
{
LogHelp.WriteExceptionLog(ex, "图片");
return "图片路径错误";
}
}
public Task<string> MakeThumbnail(Image originalImage, string thumbnailPath, int width, int height, string mode, string name)
{
ReturnResult result = new ReturnResult();
int towidth = width;
int toheight = height;
int x = 0;
int y = 0;
int ow = originalImage.Width;
int oh = originalImage.Height;
if (mode == "")
{
if (ow > oh)
{
mode = "W";
}
else
{
mode = "H";
}
}
switch (mode)
{
case "HW"://指定高宽缩放(可能变形)
break;
case "W"://指定宽,高按比例
toheight = originalImage.Height * width / originalImage.Width;
break;
case "H"://指定高,宽按比例
towidth = originalImage.Width * height / originalImage.Height;
break;
case "Cut"://指定高宽裁减(不变形)
if ((double)originalImage.Width / (double)originalImage.Height > (double)towidth / (double)toheight)
{
oh = originalImage.Height;
ow = originalImage.Height * towidth / toheight;
y = 0;
x = (originalImage.Width - ow) / 2;
}
else
{
ow = originalImage.Width;
oh = originalImage.Width * height / towidth;
x = 0;
y = (originalImage.Height - oh) / 2;
}
break;
default:
break;
}
//新建一个bmp图片
Image bitmap = new System.Drawing.Bitmap(towidth, toheight);
//新建一个画板
Graphics g = System.Drawing.Graphics.FromImage(bitmap);
//设置高质量插值法
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
//设置高质量,低速度呈现平滑程度
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
//清空画布并以透明背景色填充
g.Clear(Color.Transparent);
//在指定位置并且按指定大小绘制原图片的指定部分
g.DrawImage(originalImage, new Rectangle(0, 0, towidth, toheight),
new Rectangle(x, y, ow, oh),
GraphicsUnit.Pixel);
try
{
if (!Directory.Exists(thumbnailPath))
{
Directory.CreateDirectory(thumbnailPath);
}
//以jpg格式保存缩略图
bitmap.Save(thumbnailPath + "2" + name + ".jpg");
ImgServerController.CompressImage(thumbnailPath + "2" + name + ".jpg", thumbnailPath + name + ".jpg");
//System.IO.File.Delete(thumbnailPath + "2" + name + ".jpg");
return new Task<string>(() => thumbnailPath + name + ".jpg");
//return thumbnailPath + info.Name;
}
catch (System.Exception e)
{
LogHelp.WriteExceptionLog(e, this.GetType().Name);
return null;
}
finally
{
originalImage.Dispose();
bitmap.Dispose();
g.Dispose();
}
}
public string FtpUploadShow(string filename, string ftpServerIP)
{
//filename += ".jpg";
string ftpUserID = "uts_manager";//ftp账号
string ftpPassword = "uts_Inhaos@all";//ftp密码
FileInfo fileInf = new FileInfo(filename);
FtpWebRequest reqFTP;
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback(ValidateServerCertificate);
try
{
// 根据uri创建FtpWebRequest对象
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" + fileInf.Name));
string s = fileInf.Name;
// ftp用户名和密码
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
// 默认为true连接不会被关闭
// 在一个命令之后被执行
reqFTP.KeepAlive = true;
//如果要连接的 FTP 服务器要求凭据并支持安全套接字层 (SSL),则应将 EnableSsl 设置为 true。如果不写会报出421错误服务不可用
reqFTP.EnableSsl = false;
// 指定执行什么命令
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
// 指定数据传输类型
reqFTP.UseBinary = true;
// 上传文件时通知服务器文件的大小
reqFTP.ContentLength = fileInf.Length;
// 缓冲大小设置为 10kb
int buffLength = 10480;
byte[] buff = new byte[buffLength];
int contentLen;
// 打开一个文件流 (System.IO.FileStream) 去读上传的文件
FileStream fs = fileInf.OpenRead();
try
{
// 把上传的文件写入流
Stream strm = reqFTP.GetRequestStream();
// 每次读文件流的buffLength kb
contentLen = fs.Read(buff, 0, buffLength);
// 流内容没有结束
while (contentLen != 0)
{
// 把内容从file stream 写入 upload stream
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
}
// 关闭两个流
strm.Close();
fs.Close();
return fileInf.Name;
}
catch (Exception ex)
{
LogHelp.WriteExceptionLog(ex,"图片ftp错误"+ex.Message);
}
}
catch (Exception e)
{
LogHelp.WriteExceptionLog(e, "图片ftp错误" + e.Message);
}
return null;
}
public static bool ValidateServerCertificate
(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}
}
}

View File

@@ -0,0 +1,13 @@
using Face.Domain.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public static class stact
{
public static FaceEntitiesShow context = new FaceEntitiesShow();
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class tbl_face_key
{
public int Id { get; set; }
public DateTime CreateDateTime { get; set; }
public string MsgID { get; set; }
public string AppKey { get; set; }
public string TimeStamp { get; set; }
public string SN { get; set; }
public string Key { get; set; }
public int ReqType { get; set; }
public int RequstCnt { get; set; }
public string Return { get; set; }
public string Result { get; set; }
public string Remark { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class tbl_face_key_assign_log
{
public int Id { get; set; }
public string IP { get; set; }
public DateTime CreateDateTime { get; set; }
public string MsgID { get; set; }
public string AppKey { get; set; }
public string TimeStamp { get; set; }
public string SN { get; set; }
public string Key { get; set; }
public int ReqType { get; set; }
public int RequstCnt { get; set; }
public string Return { get; set; }
public string Result { get; set; }
public string Remark { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class tbl_face_key_request_log
{
public int Id { get; set; }
public string IP { get; set; }
public string MsgID { get; set; }
public string AppKey { get; set; }
public string TimeStamp { get; set; }
public string HotelID { get; set; }
public int RoomID { get; set; }
public string DeviceSN { get; set; }
public string DeviceBrand { get; set; }
public string Key { get; set; }
public int RequstCnt { get; set; }
public string Return { get; set; }
public string Result { get; set; }
public string Remark { get; set; }
public DateTime CreateDateTime { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Face.Web.Areas.App.Models
{
public class tbl_face_white_list
{
public int Id { get; set; }
public string ip { get; set; }
public string DOMAIN { get; set; }
public int Is_Avalable { get; set; }
public DateTime LastModified { get; set; }
public DateTime CreateDateTime { get; set; }
}
}