/// <summary> /// 验证年卡 /// </summary> /// <param name="obj"></param> /// <returns></returns> public Result <TicketResult> ValidYearTicket(CheckTicket_Object obj) { _log.Info("开始验证年卡"); string msg; int yearTicketUserId; var isCheck = _yearTicketUserService.CheckYearTicketUser(obj.Number, out msg, out yearTicketUserId); _log.Info("年卡验证结果:" + msg); if (!isCheck) { //年卡无效 return(TicketDataResult.TaskTerminationResult(msg, msg)); } var ticketSession = new TicketSession { OrderID = Guid.NewGuid().ToString("N"), Fingerprint_Pass = false, Fingerprint_Token = string.Empty, IDCard_Number = string.Empty, IDCard_Pass = false, TicketNo_Pass = false, Ticket_No = obj.Number, CallCount = 0, ParkID = "罗湖山5A", //可以用于景区id DeviceID = obj.Device.DeviceName, //可以用于设备id Temp_Fingerprint = new List <Fingerprint>() }; _log.Info("验证指纹状态:"); var list = _ticketFingerPrintService.GetFingers(yearTicketUserId); foreach (var item in list) { var finger = new Fingerprint { Data = item.FingerFeature, Token = item.FingerFeature }; ticketSession.Temp_Fingerprint.Add(finger); } _log.Info("指纹数量" + list.Count); DocomSDK.Ticket.Data.Ticket ticket = new DocomSDK.Ticket.Data.Ticket { BeginDate = DateTime.Now, //结束日期 ExpiryDate = DateTime.Now.AddDays(1), //开始日期 CapacitySize = 1, // 可用人数 NeedIDCard = false, //是否验证身份证 NeedFinger = true, UsageCount = 1, //已用人数 Number = obj.Number, //门票条码 Price = 0, //价格 TicketSource = obj.SensorSource, //门票来源 TicketType = SourceType.YearTicket.ToString(), //门票类型 UR_Text1 = yearTicketUserId.ToString(), //使用预留字段 }; _log.Info("发送指纹验证请求:" + OperationCode.VerifyFingerprints); return(TicketDataResult.VerifyFingerprintsResult(ticket, ticketSession, "验证指纹", "验证指纹")); }
/// <summary> /// 验票的判断方法 /// </summary> /// <param name="obj"></param> /// <param name="type"></param> /// <param name="model"></param> /// <param name="msg"></param> /// <returns></returns> private Result <TicketResult> TicketResult(CheckTicket_Object obj, SourceType type, TicketTestingModel model, string msg) { var ticketSession = new TicketSession { OrderID = Guid.NewGuid().ToString("N"), Fingerprint_Pass = false, Fingerprint_Token = string.Empty, IDCard_Number = string.Empty, IDCard_Pass = false, TicketNo_Pass = false, Ticket_No = obj.Number, CallCount = 0, //ParkID = "罗湖山5A",//可以用于景区id DeviceID = obj.Device.DeviceName//可以用于设备id }; DocomSDK.Ticket.Data.Ticket ticket = new DocomSDK.Ticket.Data.Ticket() { BeginDate = model.ValidityDateStart, //开始日期 ExpiryDate = model.ValidityDateEnd, //结束日期 CapacitySize = model.Quantity, //总人数 UsageCount = model.UsedQuantity, // 已入园人数 NeedIDCard = false, //是否验证身份证 NeedFinger = false, Number = obj.Number, //门票条码 Price = 0, //价格 TicketSource = obj.SensorSource, //门票来源 TicketType = type.ToString(), //门票类型 UR_Text1 = model.TicketTestingId.ToString(), //使用预留字段 }; DateTime now = DateTime.Now; if (ticket.ExpiryDate.Date < now.Date) { //提示已超出有效日期 return(TicketDataResult.TicketOverdueResult(ticket)); } if (ticket.CapacitySize <= ticket.UsageCount) { //提示该票已用完 return(TicketDataResult.TicketOffResult(ticket, ticketSession)); } if (ticket.BeginDate.Date > now.Date) { //提示未到生效日期 return(TicketDataResult.TicketNotEnableResult(ticket)); } if (model.DelayCheckTime > now) { //该票未到入园时间 return(TicketDataResult.TicketNotDelayCheckTimeResult(ticket)); } //验证通过,通知开闸 return(TicketDataResult.VerifyPassResult(ticket, ticketSession, msg, msg)); }
public ViewResult Index() // Shows watched tickets { var session = new TicketSession(HttpContext.Session); var model = new TicketListViewModel { ActiveStore = session.GetActiveStore(), Tickets = session.GetMyTickets() }; return(View(model)); }
/// <summary> /// 验证掌静脉 /// </summary> /// <param name="obj"></param> /// <returns></returns> public Result <TicketResult> ValidPalmVein(CheckTicket_Object obj) { var ticketSession = new TicketSession { OrderID = Guid.NewGuid().ToString("N"), Fingerprint_Pass = false, Fingerprint_Token = string.Empty, IDCard_Number = string.Empty, IDCard_Pass = false, TicketNo_Pass = false, Ticket_No = obj.Number, CallCount = 0, DeviceID = obj.Device.DeviceName//可以用于设备id }; DocomSDK.Ticket.Data.Ticket ticket = new DocomSDK.Ticket.Data.Ticket() { BeginDate = DateTime.Now, //开始日期 ExpiryDate = DateTime.Now, //结束日期 CapacitySize = 1, //总人数 UsageCount = 1, // 已入园人数 NeedIDCard = false, //是否验证身份证 NeedFinger = false, Number = obj.Number, //门票条码 Price = 0, //价格 TicketSource = obj.SensorSource, //门票来源 TicketType = SourceType.PalmVein.ToString() //门票类型 }; if (obj.Device.DeviceName == "2f0fae9db03e9b73") { TestHelper.IsAction = false; //添加掌静脉特征 var isAdd = _venaService.CreateFeature(obj.Number); if (!isAdd) { return(TicketDataResult.TaskTerminationResult("采集失败", "采集失败")); } return(TicketDataResult.VerifyPassResult(ticket, ticketSession, "采集成功", "采集成功")); } TestHelper.IsAction = true; //比对掌静脉特征 var result = _venaService.SearchFeature(obj.Number); if (!result) { return(TicketDataResult.TaskTerminationResult("验证失败", "验证失败")); } return(TicketDataResult.VerifyPassResult(ticket, ticketSession, "验证成功,欢迎光临", "验证成功,欢迎光临")); }
public RedirectToActionResult Delete() // Clears watched tickets { var session = new TicketSession(HttpContext.Session); var cookies = new TicketCookies(Response.Cookies); session.RemoveMyTickets(); cookies.RemoveMyTicketIds(); TempData["message"] = "Watched tickets cleared"; return(RedirectToAction("Ticket", "Home", new { ActiveStore = session.GetActiveStore(), })); }
/// <summary> /// 验票的流程及判断方法 /// </summary> /// <param name="ticket"></param> /// <param name="session"></param> /// <returns></returns> private Result <TicketResult> Schedule_Ticket(DocomSDK.Ticket.Data.Ticket ticket, TicketSession session) { //先判断会话有否超时 if (session == null) { return(TicketDataResult.FailResult("会话超时", "操作超时")); } //判断订单号及票号是否一致 if (session.Ticket_No != ticket.Number) { return(TicketDataResult.FailResult("订单号码及票号不一致", "订单号码及票号不一致")); } //判断是否在有效期内 DateTime now = DateTime.Now; //判断是否已超出有效日期 if (ticket.ExpiryDate.Date < now.Date) { //提示已超出有效日期 return(TicketDataResult.TicketOverdueResult(ticket)); } //判断是否票已用完 if (ticket.CapacitySize <= ticket.UsageCount) { return(TicketDataResult.TicketOffResult(ticket, session)); } //判断是否未到生效日期 if (ticket.BeginDate.Date > now.Date) { //提示未到生效日期 return(TicketDataResult.TicketNotEnableResult(ticket)); } //票要求验指纹,并且还未验过 if (!session.Fingerprint_Pass && ticket.NeedFinger) { //如果系统中已有指纹,则直接校验。 //否则,先进行采集(只支持单人,多人必须是卖票的时候同时录好) //提示设备要求验指纹 return(TicketDataResult.VerifyFingerprintsResult(ticket, session, "请验证指纹", "请验证指纹")); } return(TicketDataResult.VerifyPassResult(ticket, session, "欢迎光临", "欢迎光临")); }
/// <summary> /// 请求验证指纹 /// </summary> /// <param name="ticket"></param> /// <param name="session"></param> /// <param name="description"></param> /// <param name="tts"></param> /// <returns></returns> public static Result <TicketResult> VerifyFingerprintsResult(DocomSDK.Ticket.Data.Ticket ticket, TicketSession session, string description = "验证指纹", string tts = "") { var result = new Result <TicketResult> { State = Result_Code.OK, Description = description, TTS = tts, Data = new TicketResult { Code = OperationCode.VerifyFingerprints, //Code = OperationCode.CollectFingerprints, TicketData = ticket, Session = session } }; return(result); }
/// <summary> /// 该票已用完(人次) /// </summary> /// <param name="ticket"></param> /// <param name="session"></param> /// <returns></returns> public static Result <TicketResult> TicketOffResult(DocomSDK.Ticket.Data.Ticket ticket, TicketSession session) { var result = new Result <TicketResult> { State = Result_Code.OK, Description = "该票已用完", TTS = "该票已用完", Data = new TicketResult { Code = OperationCode.TicketOff, TicketData = ticket, Session = session } }; return(result); }