Esempio n. 1
0
        /// <summary>
        /// 修改订单基础数据验证
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DataValidResult ValidDataForOrderUpdateRequest(OrderUpdateRequest request)
        {
            var orderInfo = request.Body.OrderInfo;
            var result    = new DataValidResult {
                Status = false
            };

            if (orderInfo.ContactPerson == null)
            {
                result.Code    = "116001";
                result.Message = "修改订单异常,取票人信息为空";
                return(result);
            }
            if (string.IsNullOrEmpty(orderInfo.ContactPerson.Name))
            {
                result.Code    = "116002";
                result.Message = "修改订单异常,取票人姓名不能为空";
                return(result);
            }
            if (string.IsNullOrEmpty(orderInfo.ContactPerson.Mobile))
            {
                result.Code    = "116003";
                result.Message = "修改订单异常,取票人手机号码不能为空";
                return(result);
            }
            if (!RegexValidation.IsCellPhone(orderInfo.ContactPerson.Mobile))
            {
                result.Code    = "116004";
                result.Message = "修改订单异常,取票人手机号码异常";
                return(result);
            }
            if (!string.IsNullOrEmpty(orderInfo.ContactPerson.CardType))
            {
                switch (orderInfo.ContactPerson.CardType.ToUpper())
                {
                case "ID_CARD":
                    if (string.IsNullOrEmpty(orderInfo.ContactPerson.CardNo))
                    {
                        result.Code    = "116005";
                        result.Message = "修改订单异常,游客身份证信息不能为空";
                        return(result);
                    }
                    if (!RegexValidation.IsIdCard(orderInfo.ContactPerson.CardNo))
                    {
                        result.Code    = "116006";
                        result.Message = "修改订单异常,游客身份证信息输入有误";
                        return(result);
                    }
                    break;

                case "HUZHAO":
                case "TAIBAO":
                case "GANGAO":
                case "OTHER":
                    break;

                default:
                    result.Code    = "116007";
                    result.Message = "修改订单异常,取票人证件类型异常";
                    return(result);
                }
            }
            else
            {
                result.Code    = "116008";
                result.Message = "修改订单异常,取票人证件类型不能为空";
                return(result);
            }
            if (!orderInfo.VisitDate.IsDataTime())
            {
                result.Code    = "116009";
                result.Message = "修改订单异常,游玩日期格式不合法";
                return(result);
            }

            if (orderInfo.VisitDate.ToDataTime() < DateTime.Now.Date)
            {
                result.Code    = "116010";
                result.Message = "修改订单异常,游玩日期不能小于今天";
                return(result);
            }
            result.Status = true;
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 创建单个订单基础数据验证
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DataValidResult ValidDataForOrderSingleCreateRequest(OrderSingleCreateRequest request, OrderSingleCreateResponse response)
        {
            var orderInfo = request.Body.OrderInfo;
            var result    = new DataValidResult {
                Status = false
            };

            if (orderInfo.ContactPerson == null)
            {
                result.Code    = "113001";
                result.Message = "创建订单异常,取票人信息为空";
                return(result);
            }
            if (string.IsNullOrEmpty(orderInfo.ContactPerson.Name))
            {
                result.Code    = "113002";
                result.Message = "创建订单异常,取票人姓名不能为空";
                return(result);
            }
            if (string.IsNullOrEmpty(orderInfo.ContactPerson.Mobile))
            {
                result.Code    = "113003";
                result.Message = "创建订单异常,取票人手机号码不能为空";
                return(result);
            }
            if (!RegexValidation.IsCellPhone(orderInfo.ContactPerson.Mobile))
            {
                result.Code    = "113004";
                result.Message = "创建订单异常,取票人手机号码异常";
                return(result);
            }
            if (!string.IsNullOrEmpty(orderInfo.ContactPerson.CardType))
            {
                switch (orderInfo.ContactPerson.CardType.ToUpper())
                {
                case "ID_CARD":
                    if (!string.IsNullOrEmpty(orderInfo.ContactPerson.CardNo))
                    {
                        if (!RegexValidation.IsIdCard(orderInfo.ContactPerson.CardNo))
                        {
                            result.Code    = "113005";
                            result.Message = "创建订单异常,游客身份证信息输入有误";
                            return(result);
                        }
                    }
                    break;

                case "HUZHAO":
                case "TAIBAO":
                case "GANGAO":
                case "OTHER":
                    break;
                }
            }

            if (string.IsNullOrEmpty(orderInfo.OrderOtaId))
            {
                result.Code    = "113006";
                result.Message = "创建订单异常,OTA订单id不能为空";
                return(result);
            }

            if (orderInfo.OrderQuantity <= 0)
            {
                result.Code    = "113008";
                result.Message = "创建订单异常,订票总数量不能小于1";
                return(result);
            }
            if (!orderInfo.VisitDate.IsDataTime())
            {
                result.Code    = "113009";
                result.Message = "创建订单异常,游玩日期格式不合法";
                return(result);
            }
            if (orderInfo.VisitDate.ToDataTime() < DateTime.Now.Date)
            {
                result.Code    = "113009";
                result.Message = "创建订单异常,游玩日期不合法";
                return(result);
            }
            if (orderInfo.Ticket == null)
            {
                result.Code    = "113015";
                result.Message = "创建订单异常,购买产品的数据不合法";
                return(result);
            }
            if (orderInfo.Ticket.Quantity != orderInfo.OrderQuantity)
            {
                result.Code    = "113011";
                result.Message = "创建订单异常,购买产品的总数量和订票总数量不符";
                return(result);
            }

            if (orderInfo.Ticket.Quantity <= 0)
            {
                result.Code    = "113013";
                result.Message = "创建订单异常,购买产品的游客人数不能小于1";
                return(result);
            }
            if (orderInfo.Ticket.ProductId <= 0)
            {
                result.Code    = "113014";
                result.Message = "创建订单异常,购买产品的id不合法";
                return(result);
            }
            //验证OTA订单id是否已存在
            var tbl_Order = GetOrderBy(request.Body.OrderInfo.OrderOtaId);

            if (tbl_Order != null)
            {
                var tbl_OrderDetail = _orderDetailService.Get(tbl_Order.OrderNo);
                result.Code                 = "000000";
                result.Message              = "成功,重复提交订单";
                response.Body.OrderId       = tbl_Order.OrderNo;
                response.Body.OtaOrderId    = tbl_Order.OTAOrderNo;
                response.Body.CertificateNo = tbl_OrderDetail.CertificateNO;
                response.Body.Code          = tbl_OrderDetail.QRcode;
                response.Body.OrderStatus   = "OREDER_SUCCESS";
                return(result);
            }
            result.Status = true;
            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// 下单验证基础数据验证
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DataValidResult ValidDataForVerifyOrderRequest(OrderSingleCreateRequest request)
        {
            var orderInfo = request.Body.OrderInfo;
            var result    = new DataValidResult {
                Status = false
            };

            if (orderInfo.ContactPerson == null)
            {
                result.Code    = "113001";
                result.Message = "创建订单异常,取票人信息为空";
                return(result);
            }
            if (string.IsNullOrEmpty(orderInfo.ContactPerson.Name))
            {
                result.Code    = "113002";
                result.Message = "创建订单异常,取票人姓名不能为空";
                return(result);
            }
            if (string.IsNullOrEmpty(orderInfo.ContactPerson.Mobile))
            {
                result.Code    = "113003";
                result.Message = "创建订单异常,取票人手机号码不能为空";
                return(result);
            }
            if (!RegexValidation.IsCellPhone(orderInfo.ContactPerson.Mobile))
            {
                result.Code    = "113004";
                result.Message = "创建订单异常,取票人手机号码异常";
                return(result);
            }
            if (!string.IsNullOrEmpty(orderInfo.ContactPerson.CardType))
            {
                switch (orderInfo.ContactPerson.CardType.ToUpper())
                {
                case "ID_CARD":
                    if (!string.IsNullOrEmpty(orderInfo.ContactPerson.CardNo))
                    {
                        if (!RegexValidation.IsIdCard(orderInfo.ContactPerson.CardNo))
                        {
                            result.Code    = "113005";
                            result.Message = "创建订单异常,游客身份证信息输入有误";
                            return(result);
                        }
                    }
                    break;

                case "HUZHAO":
                case "TAIBAO":
                case "GANGAO":
                case "OTHER":
                    break;
                }
            }
            if (orderInfo.OrderQuantity <= 0)
            {
                result.Code    = "113008";
                result.Message = "创建订单异常,订票总数量不能小于1";
                return(result);
            }
            if (!orderInfo.VisitDate.IsDataTime())
            {
                result.Code    = "113009";
                result.Message = "创建订单异常,游玩日期格式不合法";
                return(result);
            }
            if (orderInfo.VisitDate.ToDataTime() < DateTime.Now.Date)
            {
                result.Code    = "113009";
                result.Message = "创建订单异常,游玩日期不合法";
                return(result);
            }
            if (orderInfo.Ticket == null)
            {
                result.Code    = "113015";
                result.Message = "创建订单异常,购买产品的数据不合法";
                return(result);
            }
            if (orderInfo.Ticket.Quantity <= 0)
            {
                result.Code    = "113013";
                result.Message = "创建订单异常,购买产品的游客人数不能小于1";
                return(result);
            }
            if (orderInfo.Ticket.ProductId <= 0)
            {
                result.Code    = "113014";
                result.Message = "创建订单异常,购买产品的id不合法";
                return(result);
            }

            result.Status = true;
            return(result);
        }
Esempio n. 4
0
        /// <summary>
        /// 创建订单基础数据验证
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DataValidResult ValidDataForOrderCreateRequest(OrderCreateRequest request)
        {
            var orderInfo = request.Body.OrderInfo;
            var result    = new DataValidResult {
                Status = false
            };

            if (orderInfo.ContactPerson == null)
            {
                result.Code    = "113001";
                result.Message = "创建订单异常,取票人信息为空";
                return(result);
            }
            if (string.IsNullOrEmpty(orderInfo.ContactPerson.Name))
            {
                result.Code    = "113002";
                result.Message = "创建订单异常,取票人姓名不能为空";
                return(result);
            }
            if (string.IsNullOrEmpty(orderInfo.ContactPerson.Mobile))
            {
                result.Code    = "113003";
                result.Message = "创建订单异常,取票人手机号码不能为空";
                return(result);
            }
            if (!RegexValidation.IsCellPhone(orderInfo.ContactPerson.Mobile))
            {
                result.Code    = "113004";
                result.Message = "创建订单异常,取票人手机号码异常";
                return(result);
            }
            if (!string.IsNullOrEmpty(orderInfo.ContactPerson.CardType))
            {
                switch (orderInfo.ContactPerson.CardType.ToUpper())
                {
                case "ID_CARD":
                    if (string.IsNullOrEmpty(orderInfo.ContactPerson.CardNo))
                    {
                        result.Code    = "113023";
                        result.Message = "创建订单异常,游客身份证信息不能为空";
                        return(result);
                    }
                    if (!RegexValidation.IsIdCard(orderInfo.ContactPerson.CardNo))
                    {
                        result.Code    = "113005";
                        result.Message = "创建订单异常,游客身份证信息输入有误";
                        return(result);
                    }
                    break;

                case "HUZHAO":
                case "TAIBAO":
                case "GANGAO":
                case "OTHER":
                    break;

                default:
                    result.Code    = "113022";
                    result.Message = "创建订单异常,取票人证件类型异常";
                    return(result);
                }
            }
            else
            {
                result.Code    = "113024";
                result.Message = "创建订单异常,取票人证件类型不能为空";
                return(result);
            }
            if (string.IsNullOrEmpty(orderInfo.OrderOtaId))
            {
                result.Code    = "113006";
                result.Message = "创建订单异常,OTA订单id不能为空";
                return(result);
            }
            if (orderInfo.OrderPrice <= 0)
            {
                result.Code    = "113007";
                result.Message = "创建订单异常,订单总金额不能小于0";
                return(result);
            }
            if (orderInfo.OrderQuantity <= 0)
            {
                result.Code    = "113008";
                result.Message = "创建订单异常,订票总数量不能小于1";
                return(result);
            }
            if (!orderInfo.VisitDate.IsDataTime())
            {
                result.Code    = "113009";
                result.Message = "创建订单异常,游玩日期格式不合法";
                return(result);
            }
            if (orderInfo.TicketList == null || orderInfo.TicketList.Count <= 0)
            {
                result.Code    = "113010";
                result.Message = "创建订单异常,购买产品的数量不能小于1";
                return(result);
            }
            if (orderInfo.TicketList.Sum(a => a.Quantity) != orderInfo.OrderQuantity)
            {
                result.Code    = "113011";
                result.Message = "创建订单异常,购买产品的总数量和订票总数量不符";
                return(result);
            }
            if (orderInfo.TicketList.Sum(a => a.SellPrice * a.Quantity) != orderInfo.OrderPrice)
            {
                result.Code    = "113012";
                result.Message = "创建订单异常,购买产品的总金额和订票总金额不符";
                return(result);
            }
            foreach (var row in orderInfo.TicketList)
            {
                if (row.Quantity <= 0)
                {
                    result.Code    = "113013";
                    result.Message = "创建订单异常,购买产品的游客人数不能小于1";
                    return(result);
                }
                if (row.ProductId <= 0)
                {
                    result.Code    = "113014";
                    result.Message = "创建订单异常,购买产品的id不合法";
                    return(result);
                }
                if (orderInfo.TicketList == null)
                {
                    result.Code    = "113015";
                    result.Message = "创建订单异常,购买产品的数据不合法";
                    return(result);
                }
                if (row.SellPrice <= 0)
                {
                    result.Code    = "113016";
                    result.Message = "创建订单异常,购买产品的金额不合法";
                    return(result);
                }
            }

            if (orderInfo.OrderPayStatus > 1 || orderInfo.OrderPayStatus < 0)
            {
                result.Code    = "113017";
                result.Message = "创建订单异常,是否收款超出范围";
                return(result);
            }
            //验证OTA订单id是否已存在
            var otaOrder = GetOrderBy(request.Body.OrderInfo.OrderOtaId);

            if (otaOrder != null)
            {
                result.Code    = "113018";
                result.Message = "创建订单异常,OTA订单id已存在";
                return(result);
            }
            result.Status = true;
            return(result);
        }
        /// <summary>
        /// 创建订单基础数据验证
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DataValidResult ValidDataForOrderCreateRequest(OrderCreateRequest request, OrderCreateResponse response)
        {
            var orderInfo = request.Body.OrderInfo;
            var result    = new DataValidResult {
                Status = false
            };

            if (orderInfo.ContactPerson == null)
            {
                result.Code    = "113001";
                result.Message = "创建订单异常,取票人信息为空";
                return(result);
            }
            if (string.IsNullOrEmpty(orderInfo.ContactPerson.Name))
            {
                result.Code    = "113002";
                result.Message = "创建订单异常,取票人姓名不能为空";
                return(result);
            }
            if (string.IsNullOrEmpty(orderInfo.ContactPerson.Mobile))
            {
                result.Code    = "113003";
                result.Message = "创建订单异常,取票人手机号码不能为空";
                return(result);
            }
            if (!RegexValidation.IsCellPhone(orderInfo.ContactPerson.Mobile))
            {
                result.Code    = "113004";
                result.Message = "创建订单异常,取票人手机号码异常";
                return(result);
            }
            if (!string.IsNullOrEmpty(orderInfo.ContactPerson.CardType))
            {
                if (orderInfo.ContactPerson.CardType.ToUpper() == "ID_CARD" && !string.IsNullOrEmpty(orderInfo.ContactPerson.CardNo))
                {
                    if (!RegexValidation.IsIdCard(orderInfo.ContactPerson.CardNo))
                    {
                        result.Code    = "113005";
                        result.Message = "创建订单异常,游客身份证信息输入有误";
                        return(result);
                    }
                }
            }

            if (string.IsNullOrEmpty(orderInfo.OrderOtaId))
            {
                result.Code    = "113006";
                result.Message = "创建订单异常,OTA订单id不能为空";
                return(result);
            }
            if (orderInfo.OrderPrice <= 0)
            {
                result.Code    = "113007";
                result.Message = "创建订单异常,订单总金额不能小于0";
                return(result);
            }
            if (orderInfo.OrderQuantity <= 0)
            {
                result.Code    = "113008";
                result.Message = "创建订单异常,订票总数量不能小于1";
                return(result);
            }
            if (!orderInfo.VisitDate.IsDataTime())
            {
                result.Code    = "113009";
                result.Message = "创建订单异常,游玩日期格式不合法";
                return(result);
            }
            if (orderInfo.TicketList == null || orderInfo.TicketList.Count <= 0)
            {
                result.Code    = "113010";
                result.Message = "创建订单异常,购买产品的数量不能小于1";
                return(result);
            }
            if (orderInfo.TicketList.Sum(a => a.Quantity) != orderInfo.OrderQuantity)
            {
                result.Code    = "113011";
                result.Message = "创建订单异常,购买产品的总数量和订票总数量不符";
                return(result);
            }
            if (orderInfo.TicketList.Sum(a => a.SellPrice * a.Quantity) != orderInfo.OrderPrice)
            {
                result.Code    = "113012";
                result.Message = "创建订单异常,购买产品的总金额和订票总金额不符";
                return(result);
            }
            foreach (var row in orderInfo.TicketList)
            {
                if (row.Quantity <= 0)
                {
                    result.Code    = "113013";
                    result.Message = "创建订单异常,购买产品的游客人数不能小于1";
                    return(result);
                }
                if (row.ProductId <= 0)
                {
                    result.Code    = "113014";
                    result.Message = "创建订单异常,购买产品的id不合法";
                    return(result);
                }
                if (orderInfo.TicketList == null)
                {
                    result.Code    = "113015";
                    result.Message = "创建订单异常,购买产品的数据不合法";
                    return(result);
                }
                if (row.SellPrice <= 0)
                {
                    result.Code    = "113016";
                    result.Message = "创建订单异常,购买产品的金额不合法";
                    return(result);
                }
            }

            if (orderInfo.OrderPayStatus > 1 || orderInfo.OrderPayStatus < 0)
            {
                result.Code    = "113017";
                result.Message = "创建订单异常,是否收款超出范围";
                return(result);
            }
            //验证OTA订单id是否已存在
            var tbl_Order = GetOrderBy(request.Body.OrderInfo.OrderOtaId);

            if (tbl_Order != null)
            {
                var tbl_OrderDetails = _orderDetailService.GetList(tbl_Order.OrderNo);
                result.Code    = "000000";
                result.Message = "成功,重复提交订单";
                response.Body  = new OrderCreateInfo
                {
                    OtaOrderId  = tbl_Order.OTAOrderNo,
                    OrderId     = tbl_Order.OrderNo,
                    OrderStatus = "OREDER_SUCCESS",
                    Item        = new List <OrderCreateItem>()
                };
                foreach (var row in tbl_OrderDetails)
                {
                    response.Body.Item.Add(new OrderCreateItem
                    {
                        OtaOrderDetailId = row.OtaOrderDetailId,
                        ProductId        = row.TicketId.ToString(),
                        useDate          = row.ValidityDateStart.ToString("yyyy-MM-dd"),
                        CertificateNo    = row.CertificateNO,
                        quantity         = 500000
                    });
                }
                return(result);
            }
            result.Status = true;
            return(result);
        }
        /// <summary>
        /// 验证订单基础数据验证
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DataValidResult ValidDataForOrderVerifyRequest(OrderCreateRequest request)
        {
            var orderInfo = request.Body.OrderInfo;
            var result    = new DataValidResult {
                Status = false
            };

            if (orderInfo.ContactPerson == null)
            {
                result.Code    = "113001";
                result.Message = "创建订单异常,取票人信息为空";
                return(result);
            }
            if (string.IsNullOrEmpty(orderInfo.ContactPerson.Name))
            {
                result.Code    = "113002";
                result.Message = "创建订单异常,取票人姓名不能为空";
                return(result);
            }
            if (string.IsNullOrEmpty(orderInfo.ContactPerson.Mobile))
            {
                result.Code    = "113003";
                result.Message = "创建订单异常,取票人手机号码不能为空";
                return(result);
            }
            if (!RegexValidation.IsCellPhone(orderInfo.ContactPerson.Mobile))
            {
                result.Code    = "113004";
                result.Message = "创建订单异常,取票人手机号码异常";
                return(result);
            }
            if (!string.IsNullOrEmpty(orderInfo.ContactPerson.CardType))
            {
                if (orderInfo.ContactPerson.CardType.ToUpper() == "ID_CARD" && !string.IsNullOrEmpty(orderInfo.ContactPerson.CardNo))
                {
                    if (!RegexValidation.IsIdCard(orderInfo.ContactPerson.CardNo))
                    {
                        result.Code    = "113005";
                        result.Message = "创建订单异常,游客身份证信息输入有误";
                        return(result);
                    }
                }
            }

            if (orderInfo.OrderPrice <= 0)
            {
                result.Code    = "113007";
                result.Message = "创建订单异常,订单总金额不能小于0";
                return(result);
            }
            if (orderInfo.OrderQuantity <= 0)
            {
                result.Code    = "113008";
                result.Message = "创建订单异常,订票总数量不能小于1";
                return(result);
            }
            if (!orderInfo.VisitDate.IsDataTime())
            {
                result.Code    = "113009";
                result.Message = "创建订单异常,游玩日期格式不合法";
                return(result);
            }
            if (orderInfo.TicketList == null || orderInfo.TicketList.Count <= 0)
            {
                result.Code    = "113010";
                result.Message = "创建订单异常,购买产品的数量不能小于1";
                return(result);
            }
            if (orderInfo.TicketList.Sum(a => a.Quantity) != orderInfo.OrderQuantity)
            {
                result.Code    = "113011";
                result.Message = "创建订单异常,购买产品的总数量和订票总数量不符";
                return(result);
            }
            if (orderInfo.TicketList.Sum(a => a.SellPrice * a.Quantity) != orderInfo.OrderPrice)
            {
                result.Code    = "113012";
                result.Message = "创建订单异常,购买产品的总金额和订票总金额不符";
                return(result);
            }
            foreach (var row in orderInfo.TicketList)
            {
                if (row.Quantity <= 0)
                {
                    result.Code    = "113013";
                    result.Message = "创建订单异常,购买产品的游客人数不能小于1";
                    return(result);
                }
                if (row.ProductId <= 0)
                {
                    result.Code    = "113014";
                    result.Message = "创建订单异常,购买产品的id不合法";
                    return(result);
                }
                if (orderInfo.TicketList == null)
                {
                    result.Code    = "113015";
                    result.Message = "创建订单异常,购买产品的数据不合法";
                    return(result);
                }
                if (row.SellPrice <= 0)
                {
                    result.Code    = "113016";
                    result.Message = "创建订单异常,购买产品的金额不合法";
                    return(result);
                }
            }

            if (orderInfo.OrderPayStatus > 1 || orderInfo.OrderPayStatus < 0)
            {
                result.Code    = "113017";
                result.Message = "创建订单异常,是否收款超出范围";
                return(result);
            }

            result.Status = true;
            return(result);
        }