Exemple #1
0
        /// <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, "验证指纹", "验证指纹"));
        }
Exemple #2
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 #3
0
        /// <summary>
        /// 验证身份证
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public Result <TicketResult> ValidIdCard(CheckTicket_Object obj)
        {
            string             msg;
            TicketTestingModel ticketTestingModel;
            var isCheck = _ticketTestingService.CheckTicketIdCard(obj.Number, out msg, out ticketTestingModel);

            if (!isCheck)
            {
                return(TicketDataResult.TaskTerminationResult(msg, msg));
            }
            return(TicketResult(obj, SourceType.IdCard, ticketTestingModel, msg));
        }
Exemple #4
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, "验证成功,欢迎光临", "验证成功,欢迎光临"));
        }
Exemple #5
0
        /// <summary>
        /// 验证条形码
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public Result <TicketResult> ValidBarCode(CheckTicket_Object obj)
        {
            _log.Info("开始验证条形码");
            string             msg;
            TicketTestingModel ticketTestingModel;
            var isCheck = _ticketTestingService.CheckTicketBarCode(obj.Number, out msg, out ticketTestingModel);

            _log.Info("条形码验证结果:" + msg);
            if (!isCheck)
            {
                return(TicketDataResult.TaskTerminationResult(msg, msg));
            }
            return(TicketResult(obj, SourceType.BarCode, ticketTestingModel, msg));
        }
Exemple #6
0
        /// <summary>
        /// 验证二维码
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public Result <TicketResult> ValidQRcode(CheckTicket_Object obj)
        {
            _log.Info("开始验证二维码");
            var qrCode = _ticketTestingService.QrCodeDecrypt(obj.Number);

            if (string.IsNullOrEmpty(qrCode))
            {
                _log.Info("解密二维码失败");
                return(TicketDataResult.TaskTerminationResult(MessageKey.InvalidTicket, MessageKey.InvalidTicket));
            }
            _log.Info("解密二维码成功");
            string             msg;
            TicketTestingModel ticketTestingModel;
            var isCheck = _ticketTestingService.CheckTicketQrCode(qrCode, out msg, out ticketTestingModel);

            _log.Info("二维码验证结果:" + msg);
            if (!isCheck)
            {
                return(TicketDataResult.TaskTerminationResult(msg, msg));
            }
            return(TicketResult(obj, SourceType.QRcode, ticketTestingModel, msg));
        }