Exemple #1
0
        /// <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));
        }
Exemple #2
0
        /// <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, "验证成功,欢迎光临", "验证成功,欢迎光临"));
        }