Exemple #1
0
        public ActionResult AllotEditProvide(Guid id)
        {
            if (!base.HasPermission("PosApply", PermissionOperate.track))
            {
                return(JsonMessage(false, "你没有分配客户经理的权限"));
            }

            PosApply apply = _posApplyService.GetById(id);

            if (apply.Status == 1)
            {
                return(JsonMessage(false, "该笔工单已被撤销,不能继续操作!"));
            }

            if (apply.ProcessStatus == 1 || apply.ProcessStatus == 2)
            {
                return(JsonMessage(false, "该笔工单已被受理,不能继续操作!"));
            }

            UpdateModel <PosApply>(apply);
            apply.AssignStatus = 1;
            _posApplyService.Update(apply);;
            base.AddLog(string.Format("分配客户经理[{0}]成功", apply.VendorName + "To" + apply.AssignCustomerManager), AdminLoggerModuleEnum.Pos);
            return(JsonMessage(true, "处理成功"));
        }
Exemple #2
0
        public ActionResult PosApplyProvide(string isEdit)
        {
            string message   = string.Empty;
            bool   isSuccess = true;

            if (!ValidatorPos(ref message))
            {
                return(JsonMessage(false, message));
            }

            //用户最近的一笔申请[未撤销]
            PosApply apply2 = _posApplyService.GetUnique(pos => pos.MpUserId == MpUserID && pos.Status == 0, "CreateDate", false);

            //有未过期的贷款申请
            if (apply2 != null && !(isEdit == "1" && (DateTime.Now - apply2.CreateDate).Hours <= 24))
            {
                return(RedirectToAction("PosMessage", new { }));
            }

            try
            {
                _posApplyService.BeginTransaction();
                //当前登录用户
                MpUser  mpUser  = _mpUserService.GetById(MpUserID);
                PosAuth posAuth = _posAuthService.GetUnique(pos => pos.MpUserId == mpUser.Id);
                ViewBag.IsAuth = false;
                if (posAuth != null)
                {
                    ViewBag.IsAuth = posAuth.IsAuth > 0;
                }
                //进行手机验证
                if (!ViewBag.IsAuth)
                {
                    int useCount = _mobileCodeService.GetMobileCodeCount(this.MpUserID, 3);//当天使用次数
                    if (useCount <= 5)
                    {
                        MobileCode lastCode = _mobileCodeService.GetMobileCode(this.MpUserID, 3);//是否存在未使用的证码
                        if (lastCode != null)
                        {
                            //验证
                            MobileCode mobileCode = _mobileCodeService.GetMobileCode(RQuery["MobilePhone"], RQuery["Code"], MpUserID, 3);

                            if (mobileCode != null)
                            {
                                TimeSpan ts = DateTime.Now.Subtract(mobileCode.CreateDate).Duration();

                                if (ts.Minutes > 10)
                                {
                                    ViewBag.CodeError = "验证码已经失效,请重新获取";
                                    isSuccess         = false;
                                }
                                PosAuth auth = new PosAuth();
                                auth.MpUserId    = MpUserID;
                                auth.Name        = RQuery["Name"];
                                auth.MobilePhone = RQuery["MobilePhone"];
                                auth.IsAuth      = 1;
                                _posAuthService.Insert(auth);
                            }
                            else
                            {
                                lastCode.Time += 1;
                                _mobileCodeService.Update(lastCode);
                                ViewBag.CodeError = "对不起,验证码有误,请检查!";
                                isSuccess         = false;
                            }
                        }
                        else
                        {
                            ViewBag.CodeError = "对不起,您还未点击发送验证码!";
                            isSuccess         = false;
                        }
                    }
                    else
                    {
                        ViewBag.CodeError = "对不起,您今天最多只能发起5次验证码!";
                        isSuccess         = false;
                    }
                }
                //处理贷款业务
                if (isEdit == "1")
                {
                    if (apply2 != null)
                    {
                        TryUpdateModel <PosApply>(apply2);
                        if (isSuccess)
                        {
                            _posApplyService.Update(apply2);
                        }
                    }
                    else
                    {
                        throw new OceanException("对不起,您的参数有误,请联系客服!");
                    }
                }
                else
                {
                    apply2 = new PosApply();
                    TryUpdateModel <PosApply>(apply2);
                    apply2.MpUserId = MpUserID;
                    apply2.Status   = apply2.AssignStatus = apply2.ProcessStatus = 0;
                    if (isSuccess)
                    {
                        _posApplyService.Insert(apply2);
                    }
                }
            }
            catch (Exception ex)
            {
                _posApplyService.Rollback();
                throw new OceanException(string.Format("对不起,{0}!", ex.Message));
            }
            finally
            {
                _posApplyService.Commit();
            }
            if (isSuccess)
            {
                return(RedirectToAction("PosApply"));
            }
            else
            {
                return(View("PosApply", apply2));
            }
        }