Пример #1
0
        public ActionResult Pay(string keyValue, string json)
        {
            try
            {
                var order = Serializer.DeserializeJson <ApplyOrderEntity>(json, true);
                if (order == null)
                {
                    return(Error("无效对象"));
                }
                var entity = ApplyOrderBLL.Instance.GetEntity(keyValue);
                if (entity != null)
                {
                    if (entity.Status != (int)RCHL.Model.Enums.PaySatus.待支付)
                    {
                        return(Error("非待支付状态的订单不能支付操作"));
                    }
                    if (entity.Status == (int)RCHL.Model.Enums.ApplyStatus.待支付)
                    {
                        entity.Status     = (int)RCHL.Model.Enums.ApplyStatus.已支付;
                        entity.TotalMoney = order.TotalMoney;
                        entity.CashType   = order.CashType;
                        ApplyOrderBLL.Instance.Update(entity);

                        //送积分
                        GivePointBLL.GivePoint(RCHL.Model.Enums.OperationType.预约驾校缴费, entity.MemberId, double.Parse(entity.TotalMoney.ToString()), entity.ApplyOrderNo);

                        //插入财务表
                        FinaceBLL.Instance.Add(new FinaceEntity()
                        {
                            FinaceId   = Util.Util.NewUpperGuid(),
                            SourceType = (int)RCHL.Model.Enums.FinaceSourceType.驾校报名,
                            ObjectId   = order.SchoolId,
                            CreateTime = DateTime.Now,
                            CosMoney   = entity.TotalMoney - entity.PayMoney,
                            Status     = (int)RCHL.Model.Enums.PaySatus.已支付,
                            MemberId   = entity.MemberId,
                            MemberName = entity.MemberName,
                            PayType    = (int)RCHL.Model.Enums.PayType.线下支付,
                            Operate    = (int)RCHL.Model.Enums.FinaceOperateType.增加,
                            Remark     = string.Format("报名学车|{0}|{1}", entity.MemberName, entity.ApplyOrderNo)
                        });
                    }
                }
                return(Success("操作成功"));
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "ApplyOrderController>>Pay";
                new ExceptionHelper().LogException(ex);
                return(Error("操作失败"));
            }
        }
Пример #2
0
        public ActionResult Pay(string keyValue, string json)
        {
            try
            {
                var order = Serializer.DeserializeJson <GroupAuditOrderEntity>(json, true);
                if (order == null)
                {
                    return(Error("无效对象"));
                }
                var entity = GroupAuditOrderBLL.Instance.GetEntity(keyValue);
                if (entity != null)
                {
                    if (entity.Status != (int)QX360.Model.Enums.PaySatus.待支付)
                    {
                        return(Error("非待支付状态的订单不能支付操作"));
                    }
                    if (entity.Status == (int)QX360.Model.Enums.PaySatus.待支付)
                    {
                        entity.Price    = order.Price;
                        entity.CashType = order.CashType;
                        entity.Status   = (int)QX360.Model.Enums.PaySatus.已支付;
                        GroupAuditOrderBLL.Instance.Update(entity);

                        //送积分
                        GivePointBLL.GivePoint(QX360.Model.Enums.OperationType.预约年检缴费, entity.MemberId, double.Parse(entity.Price.ToString()), entity.GroupAuditOrderNo);
                        //插入财务表
                        FinaceBLL.Instance.Add(new FinaceEntity()
                        {
                            FinaceId   = QSDMS.Util.Util.NewUpperGuid(),
                            SourceType = (int)QX360.Model.Enums.FinaceSourceType.年检预约,
                            ObjectId   = order.OrganizationId,
                            CreateTime = DateTime.Now,
                            CosMoney   = entity.Price,
                            Status     = (int)QX360.Model.Enums.PaySatus.已支付,
                            MemberId   = entity.MemberId,
                            MemberName = entity.MemberName,
                            PayType    = (int)QX360.Model.Enums.PayType.线下支付,
                            Operate    = (int)QX360.Model.Enums.FinaceOperateType.增加,
                            Remark     = string.Format("年检预约|{0}|{1}", entity.MemberName, entity.GroupAuditOrderNo)
                        });
                    }
                }
                return(Success("操作成功"));
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "GroupAuditOrderController>>Pay";
                new ExceptionHelper().LogException(ex);
                return(Error("操作失败"));
            }
        }
Пример #3
0
        public JsonResult Login(string UserName, string UserPwd, string OpenId, string returnurl)
        {
            var result = new ReturnMessage(false)
            {
                Message = "登陆失败!"
            };

            try
            {
                var account = MemberBLL.Instance.CheckLogin(UserName, UserPwd);
                if (account != null)
                {
                    if (account.Status == (int)QX360.Model.Enums.UseStatus.禁用)
                    {
                        result.Message = "此账户已锁定!";
                        return(Json(result));
                    }
                    //如果openid不一致之前注册的公共号换号的可能,自动更新当前的公共号信息
                    if (OpenId != account.OpenId)
                    {
                        account.OpenId = OpenId;
                        MemberBLL.Instance.Update(account);
                    }
                    //如果没有完善资料
                    //写入cookie
                    var userCookie = new HttpCookie("SSO");
                    userCookie.Expires             = DateTime.Now.AddMonths(1);
                    userCookie.Values["openid"]    = account.OpenId;
                    userCookie.Values["accountid"] = account.MemberId;
                    userCookie.Path = "/";
                    Response.Cookies.Add(userCookie);

                    result.IsSuccess = true;
                    result.Message   = "登陆成功";
                    result.ResultData["ReturnUrl"] = returnurl;

                    //送积分
                    GivePointBLL.GivePoint(QX360.Model.Enums.OperationType.登陆操作, account.MemberId, 0, "");
                }
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "AccountController>>Register";
                new ExceptionHelper().LogException(ex);
            }
            return(Json(result));
        }
Пример #4
0
        public JsonResult CreateOrder(string data)
        {
            var result = new ReturnMessage(false)
            {
                Message = "创建订单失败!"
            };

            try
            {
                lock (objLock)
                {
                    var order = JsonConvert.DeserializeObject <TakeAuditOrderEntity>(data);
                    if (order == null)
                    {
                        return(Json(result));
                    }
                    order.TakeAuditOrderId = Util.NewUpperGuid();
                    order.TakeAuditOrderNo = TakeAuditOrderBLL.Instance.GetOrderNo();
                    order.CreateTime       = DateTime.Now;
                    order.Status           = (int)Model.Enums.PaySatus.待支付;
                    order.MemberId         = LoginUser == null ? "" : LoginUser.UserId;
                    TakeAuditOrderBLL.Instance.Add(order);
                    result.IsSuccess = true;
                    result.Message   = "创建成功";

                    if (LoginUser != null)
                    {
                        //写消息
                        string servicetime = string.Format("{0} {1}", DateTime.Parse(order.ServiceDate.ToString()).ToString("yyyy-MM-dd"), order.ServiceTime);
                        string txt         = "预约代审,检测机构:" + order.OrganizationName;
                        SendSysMessageBLL.SendMessage(QX360.Model.Enums.MessageAlterType.代审预约提示, QX360.Model.Enums.NoticeType.预约提醒, LoginUser.UserId, order.MemberName, servicetime, txt, order.TakeAuditOrderNo);

                        //送积分
                        GivePointBLL.GivePoint(QX360.Model.Enums.OperationType.预约代审完成, LoginUser.UserId, double.Parse(order.Price.ToString()), order.TakeAuditOrderNo);
                    }
                }
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "TakeAuditController>>CreateOrder";
                new ExceptionHelper().LogException(ex);
            }
            return(Json(result));
        }
Пример #5
0
        public JsonResult CreateOrder(string data)
        {
            var result = new ReturnMessage(false)
            {
                Message = "创建订单失败!"
            };

            try
            {
                lock (objLock)
                {
                    var order = JsonConvert.DeserializeObject <ApplyOrderEntity>(data);
                    if (order == null)
                    {
                        return(Json(result));
                    }
                    order.ApplyOrderId = Util.NewUpperGuid();
                    order.ApplyOrderNo = ApplyOrderBLL.Instance.GetOrderNo();
                    order.CreateTime   = DateTime.Now;
                    order.Status       = (int)Model.Enums.ApplyStatus.待支付;
                    //order.CreateId = LoginUser.UserId;
                    ApplyOrderBLL.Instance.Add(order);
                    result.IsSuccess = true;
                    result.Message   = "创建成功";

                    //修改会员表中对应驾校信息
                    MemberEntity member = new MemberEntity();
                    member.SchoolId   = order.SchoolId;
                    member.SchoolName = order.SchoolName;
                    member.MemberId   = LoginUser.UserId;
                    MemberBLL.Instance.Update(member);

                    //送积分
                    GivePointBLL.GivePoint(QX360.Model.Enums.OperationType.预约驾校成功, LoginUser.UserId, double.Parse(order.TotalMoney.ToString()), order.ApplyOrderNo);

                    //插入财务表
                    FinaceBLL.Instance.Add(new FinaceEntity()
                    {
                        FinaceId   = QSDMS.Util.Util.NewUpperGuid(),
                        SourceType = (int)QX360.Model.Enums.FinaceSourceType.驾校报名,
                        CreateTime = DateTime.Now,
                        CosMoney   = order.PayMoney,
                        Status     = (int)QX360.Model.Enums.PaySatus.已支付,
                        MemberId   = order.MemberId,
                        MemberName = order.MemberName,
                        PayType    = (int)QX360.Model.Enums.PayType.微信支付,
                        Operate    = (int)QX360.Model.Enums.FinaceOperateType.增加,
                        Remark     = string.Format("报名学车|{0}|{1}", order.MemberName, order.ApplyOrderNo)
                    });

                    ////修改会员等级
                    //MemberEntity member = new MemberEntity();
                    //member.MemberId = order.MemberId;
                    //member.LevId = ((int)QX360.Model.Enums.UserType.VIP会员).ToString();
                    //member.LevName = QX360.Model.Enums.UserType.VIP会员.ToString();
                    //member.VipOverDate = DateTime.Now.AddYears(1);
                    //MemberBLL.Instance.Update(member);
                }
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "OrderController>>CreateOrder";
                new ExceptionHelper().LogException(ex);
            }
            return(Json(result));
        }
Пример #6
0
        public JsonResult CreateOrder(string data)
        {
            var result = new ReturnMessage(false)
            {
                Message = "创建订单失败!"
            };

            try
            {
                lock (objLock)
                {
                    var order = JsonConvert.DeserializeObject <StudyOrderEntity>(data);
                    if (order == null)
                    {
                        result.Message = "无效对象";
                        return(Json(result));
                    }
                    if (order.DetailList == null || order.DetailList.Count == 0)
                    {
                        result.Message = "请选择预约时间";
                        return(Json(result));
                    }
                    var member = MemberBLL.Instance.GetEntity(LoginUser.UserId);
                    if (member == null)
                    {
                        result.Message = "会员对象无效";
                        return(Json(result));
                    }

                    //验证时间段是否有预约
                    var hasflag = false;
                    foreach (var item in order.DetailList)
                    {
                        var freetime = StudyFreeTimeBLL.Instance.GetEntity(item.StudyFreeTimeId);
                        if (freetime != null)
                        {
                            if (freetime.FreeStatus != (int)RCHL.Model.Enums.FreeTimeStatus.空闲)
                            {
                                hasflag = true;
                                break;
                            }
                        }
                    }
                    if (hasflag)
                    {
                        result.Message = "您下手晚了,请重新选择预约时间";
                        return(Json(result));
                    }


                    //判断课时是否还有
                    if (order.DetailList != null)
                    {
                        int hour1 = 0;
                        int hour2 = 0;
                        foreach (var item in order.DetailList)
                        {
                            if (item.TimeType == (int)RCHL.Model.Enums.WorkTimeType.白班)
                            {
                                hour1++;
                            }
                            else if (item.TimeType == (int)RCHL.Model.Enums.WorkTimeType.夜班)
                            {
                                hour2++;
                            }
                        }
                        if ((member.StudyHour1 ?? 0) < hour1)
                        {
                            result.Message = "白班课时不足,预约此时段失败";
                            return(Json(result));
                        }
                        if ((member.StudyHour2 ?? 0) < hour2)
                        {
                            result.Message = "夜班课时不足,预约此时段失败";
                            return(Json(result));
                        }
                    }
                    //判断是否存在有未评价的订单
                    var commitcount = StudyOrderBLL.Instance.GetList(new StudyOrderEntity()
                    {
                        MemberId = LoginUser.UserId,
                        Status   = (int)RCHL.Model.Enums.StudySubscribeStatus.预约完成
                    }).Count();
                    if (commitcount > 0)
                    {
                        result.Message = "请先对上次学车订单进行评价后再次预约学习";
                        return(Json(result));
                    }
                    order.StudyOrderId = Util.NewUpperGuid();
                    order.StudyOrderNo = StudyOrderBLL.Instance.GetOrderNo();
                    order.CreateTime   = DateTime.Now;
                    order.Status       = (int)Model.Enums.StudySubscribeStatus.预约成功;
                    order.MemberId     = LoginUser.UserId;
                    order.MemberName   = LoginUser.NickName;
                    order.MemberMobile = LoginUser.Mobile;
                    string _ServiceTime = "";
                    if (StudyOrderBLL.Instance.Add(order))
                    {
                        if (order.DetailList != null)
                        {
                            foreach (var item in order.DetailList)
                            {
                                StudyOrderDetailEntity detail = new StudyOrderDetailEntity();
                                detail.StudyOrderDetailId = Util.NewUpperGuid();
                                detail.TimeType           = item.TimeType;
                                detail.ServiceTime        = item.ServiceTime;
                                detail.ServiceDate        = item.ServiceDate;
                                detail.StudyOrderId       = order.StudyOrderId;
                                detail.StudyFreeTimeId    = item.StudyFreeTimeId;
                                if (StudyOrderDetailBLL.Instance.Add(detail))
                                {
                                    _ServiceTime += detail.ServiceTime + ",";
                                    //修改预约时间状态
                                    StudyFreeTimeEntity freetime = new StudyFreeTimeEntity();
                                    freetime.StudyFreeTimeId = detail.StudyFreeTimeId;
                                    freetime.FreeStatus      = (int)RCHL.Model.Enums.FreeTimeStatus.已预约;
                                    StudyFreeTimeBLL.Instance.Update(freetime);
                                    //修改对应课时
                                    if (detail.TimeType == (int)RCHL.Model.Enums.WorkTimeType.白班)
                                    {
                                        member.MemberId   = LoginUser.UserId;
                                        member.StudyHour1 = member.StudyHour1 - 1;
                                        MemberBLL.Instance.Update(member);
                                    }
                                    else if (detail.TimeType == (int)RCHL.Model.Enums.WorkTimeType.夜班)
                                    {
                                        member.MemberId   = LoginUser.UserId;
                                        member.StudyHour2 = member.StudyHour2 - 1;
                                        MemberBLL.Instance.Update(member);
                                    }
                                }
                            }
                        }
                    }
                    result.IsSuccess = true;
                    result.Message   = "创建成功";
                    //写消息
                    string servicetime = string.Format("{0} {1}", DateTime.Parse(order.ServiceDate.ToString()).ToString("yyyy-MM-dd"), _ServiceTime.TrimEnd(','));
                    var    teacher     = TeacherBLL.Instance.GetEntity(order.TeacherId);
                    string txt         = string.Format("预约学车,预约人:{0},联系电话:{1},预约机构:{2}", teacher.Name, teacher.Mobile, order.SchoolName);
                    SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.学车预约提示, RCHL.Model.Enums.NoticeType.预约提醒, LoginUser.UserId, order.MemberName, servicetime, txt, order.StudyOrderNo);

                    txt = string.Format("预约学车,预约人:{0},联系电话:{1}", order.MemberName, order.MemberMobile);
                    SendSysMessageBLL.SendMessageTeacher(RCHL.Model.Enums.NoticeType.预约提醒, teacher.TeacherId, servicetime, txt, order.StudyOrderNo);


                    //送积分
                    GivePointBLL.GivePoint(RCHL.Model.Enums.OperationType.预约学车完成, LoginUser.UserId, 0, order.StudyOrderNo);
                }
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "StudyController>>CreateOrder";
                new ExceptionHelper().LogException(ex);
            }
            return(Json(result));
        }
Пример #7
0
        public JsonResult CreateOrder(string data, string freetimeid)
        {
            var result = new ReturnMessage(false)
            {
                Message = "创建订单失败!"
            };

            try
            {
                lock (objLock)
                {
                    var order = JsonConvert.DeserializeObject <WithDrivingOrderEntity>(data);
                    if (order == null)
                    {
                        return(Json(result));
                    }
                    //验证时间段是否有预约
                    var freetime = WithDrivingFreeTimeBLL.Instance.GetEntity(freetimeid);
                    if (freetime != null)
                    {
                        if (freetime.FreeStatus != (int)RCHL.Model.Enums.FreeTimeStatus.空闲)
                        {
                            result.Message = "您下手晚了,请重新选择预约时间";
                            return(Json(result));
                        }
                    }

                    order.DrivingOrderId = Util.NewUpperGuid();
                    order.DrivingOrderNo = WithDrivingOrderBLL.Instance.GetOrderNo();
                    order.CreateTime     = DateTime.Now;
                    order.Status         = (int)Model.Enums.PaySatus.已支付;
                    if (WithDrivingOrderBLL.Instance.Add(order))
                    {
                        //更改时间状态
                        freetime = new WithDrivingFreeTimeEntity();
                        freetime.WithDrivingFreeTimeId = freetimeid;
                        freetime.FreeStatus            = (int)RCHL.Model.Enums.FreeTimeStatus.已预约;
                        WithDrivingFreeTimeBLL.Instance.Update(freetime);
                    }
                    result.IsSuccess = true;
                    result.Message   = "创建成功";
                    //写消息
                    string servicetime = string.Format("{0} {1}", DateTime.Parse(order.ServiceDate.ToString()).ToString("yyyy-MM-dd"), order.ServiceTime);
                    var    teacher     = TeacherBLL.Instance.GetEntity(order.TeacherId);
                    if (teacher != null)
                    {
                        string content = string.Format("预约陪驾,所需费用:{1},陪驾教练:{2},联系电话:{3},陪驾车辆:{0}", order.IsBandCar == 1 ? "教练提供" : "个人提供", order.Price, teacher.Name, teacher.Mobile);
                        SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.陪驾预约提示, RCHL.Model.Enums.NoticeType.预约提醒, LoginUser.UserId, order.MemberName, servicetime, content, order.DrivingOrderNo);
                        //对象陪驾教练发送消息
                        content = string.Format("预约陪驾,所需费用:{1},陪驾车辆:{0},预约人:{2},联系电话:{3}", order.IsBandCar == 1 ? "教练提供" : "个人提供", order.Price, order.MemberName, order.MemberMobile);
                        SendSysMessageBLL.SendMessageTeacher(RCHL.Model.Enums.NoticeType.预约提醒, order.TeacherId, servicetime, content, order.DrivingOrderNo);
                    }
                    //送积分
                    GivePointBLL.GivePoint(RCHL.Model.Enums.OperationType.预约陪驾完成, LoginUser.UserId, double.Parse(order.Price.ToString()), order.DrivingOrderNo);
                }
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "WithDrivingController>>CreateOrder";
                new ExceptionHelper().LogException(ex);
            }
            return(Json(result));
        }