Ejemplo n.º 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, "处理成功"));
        }
Ejemplo n.º 2
0
        public ActionResult AddressEditProvide(Guid id)
        {
            PosApply apply = _posApplyService.GetById(id);

            UpdateModel <PosApply>(apply);
            _posApplyService.Update(apply);
            base.AddLog(string.Format("修改联系地址[{0}]成功", apply.Id.ToString()), AdminLoggerModuleEnum.Pos);
            return(JsonMessage(true, "修改成功"));
        }
Ejemplo n.º 3
0
        public ActionResult PosMessage()
        {
            //当前登录用户
            MpUser mpUser = _mpUserService.GetById(MpUserID);
            //用户最近的一笔贷款申请[未撤销]
            PosApply pos = _posApplyService.GetUnique(p => p.MpUserId == MpUserID && p.Status == 0, "CreateDate", false);

            ViewBag.PosApply = pos;
            return(View(mpUser));
        }
Ejemplo n.º 4
0
        public ActionResult GetPosApplyDetail(Guid id)
        {
            if (!base.HasPermission("PosApply", PermissionOperate.track))
            {
                return(null);
            }

            PosApply posApply = _posApplyService.GetById(id);

            return(Content(JsonConvert.SerializeObject(posApply)));
        }
Ejemplo n.º 5
0
        public ActionResult PosListProvide(PosApply posApplyDTO)
        {
            if (!base.HasPermission("PosApply", PermissionOperate.manager))
            {
                return(null);
            }

            OceanDynamicList <object> list = _posApplyService.GetPageList(PageIndex, PageSize, posApplyDTO) ?? new OceanDynamicList <object>();

            return(Content(list.ToJson(), "text/javascript"));
        }
Ejemplo n.º 6
0
        public ActionResult CanEditApply(Guid id)
        {
            string   message = string.Empty;
            PosApply pos     = _posApplyService.GetById(id);

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

            return(JsonMessage(true, ""));
        }
Ejemplo n.º 7
0
        public ActionResult PosApplyView(Guid id)
        {
            if (!base.HasPermission("PosApply", PermissionOperate.view))
            {
                return(base.ShowNotPermissionTip(""));
            }
            PosApply apply   = _posApplyService.GetById(id);
            PosAuth  posAuth = _posAuthService.GetUnique(p => p.MpUserId == apply.MpUserId);

            ViewBag.PosAuth = posAuth;
            return(View(apply));
        }
Ejemplo n.º 8
0
        public ActionResult Cancel(Guid id)
        {
            if (!base.HasPermission("PosApply", PermissionOperate.freeze))
            {
                return(JsonMessage(false, "你没有取消POS申请申请的权限"));
            }

            PosApply apply = _posApplyService.GetById(id);

            //后台已进行相关处理,不能进行编辑操作
            base.AddLog(string.Format("取消POS申请申请[{0}]成功", apply.VendorName), AdminLoggerModuleEnum.Pos);
            _posApplyService.Delete(apply);
            return(JsonMessage(true, "取消POS申请申请成功"));
        }
Ejemplo n.º 9
0
        public ActionResult CancelApply()
        {
            PosApply pos = _posApplyService.GetById(new Guid(RQuery["Id"]));

            //后台已进行相关处理,不能进行编辑操作
            if (pos.AssignStatus > 0 || pos.ProcessStatus > 0)
            {
                return(JsonMessage(false, "撤销失败,本次申请已被受理"));
            }

            pos.Status     = 1;
            pos.RepealDate = DateTime.Now;
            _posApplyService.Update(pos);
            return(JsonMessage(true, "撤销成功"));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 是否能够编辑
        /// </summary>
        private bool CanEditApply(PosApply pos, ref string message)
        {
            //后台已进行相关处理,不能进行编辑操作
            if (pos.AssignStatus > 0 || pos.ProcessStatus > 0)
            {
                message = "后台已进行相关处理,不能进行编辑操作!";
                return(false);
            }

            //修改信息只限申请的当天24点前
            if (DateTime.Now > DateTime.Parse(pos.CreateDate.AddDays(1).ToShortDateString()))
            {
                message = "修改信息只限申请的当天24点前!";
                return(false);
            }

            return(true);
        }
Ejemplo n.º 11
0
        public void ExportExcel(Guid id)
        {
            if (!base.HasPermission("PosApply", PermissionOperate.export))
            {
                return;
            }

            PosApply     apply    = _posApplyService.GetById(id);
            string       fileName = string.Format("PosApply{0}.xls", id.ToString().ToLower());
            MemoryStream ms       = RenderToExcel(apply);

            if (Request.Browser.Browser == "IE")
            {
                fileName = HttpUtility.UrlEncode(fileName);
            }

            base.AddLog(string.Format("导出POS申请工单[{0}]成功", apply.VendorName), AdminLoggerModuleEnum.Pos);
            Response.AddHeader("Content-Disposition", "attachment;fileName=" + fileName);
            Response.BinaryWrite(ms.ToArray());
        }
Ejemplo n.º 12
0
        public ActionResult PosApply(string isEdit)
        {
            //当前登录用户
            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;
            }
            ViewBag.Name = mpUser.Name;

            if (mpUser.Sex == 1)
            {
                ViewBag.Sex = "先生";
            }
            else if (mpUser.Sex == 2)
            {
                ViewBag.Sex = "女士";
            }
            else
            {
                ViewBag.Sex = "";
            }

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

            //有未过期的贷款申请
            if (posApply != null && !(isEdit == "1" && (DateTime.Now - posApply.CreateDate).Hours <= 24))
            {
                return(RedirectToAction("PosMessage", new { }));
            }
            if (posApply == null)
            {
                posApply = new PosApply();
            }
            return(View(posApply));
        }
Ejemplo n.º 13
0
        public ActionResult AcceptEditProvide(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);
            _posApplyService.Update(apply);
            string processStatus = string.Empty;

            if (apply.ProcessStatus == 1)
            {
                processStatus = "已装机";
            }
            else if (apply.ProcessStatus == 2)
            {
                processStatus = "不通过";
            }
            else if (apply.ProcessStatus == 3)
            {
                processStatus = "受理中";
            }
            base.AddLog(string.Format("受理POS申请业务[{0}]成功,受理状态变更为:{1}", apply.VendorName, processStatus), AdminLoggerModuleEnum.Pos);
            return(JsonMessage(true, "处理成功"));
        }
Ejemplo n.º 14
0
        public ActionResult ReturnVisitEditProvide(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.ReturnVisitDate > new DateTime(1900, 1, 2))
            {
                return(JsonMessage(false, "该笔工单已被回访,不能继续操作!"));
            }

            UpdateModel <PosApply>(apply);
            _posApplyService.Update(apply);
            base.AddLog(string.Format("回访POS申请业务[{0}]成功", apply.VendorName), AdminLoggerModuleEnum.Pos);
            return(JsonMessage(true, "处理成功"));
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 把数据渲染到Excel
        /// </summary>
        private MemoryStream RenderToExcel(PosApply apply)
        {
            MemoryStream ms       = new MemoryStream();
            IWorkbook    workbook = null;
            ISheet       sheet    = null;
            MpUser       mpUser   = _mpUserService.GetById(apply.MpUserId);
            PosAuth      posAuth  = _posAuthService.GetUnique(p => p.MpUserId == mpUser.Id);

            try
            {
                using (FileStream fileStream = System.IO.File.OpenRead(FileHelper.GetMapPath("/Content/ExcelTemplate/PosTemplate.xls")))   //打开xls文件
                {
                    workbook = new HSSFWorkbook(fileStream);
                    sheet    = workbook.GetSheetAt(0);
                    sheet.GetRow(1).GetCell(1).SetCellValue(posAuth.Name);
                    sheet.GetRow(1).GetCell(3).SetCellValue(posAuth.MobilePhone);
                    sheet.GetRow(1).GetCell(5).SetCellValue(apply.VendorAddress);
                    sheet.GetRow(2).GetCell(1).SetCellValue(base.LoginAdmin.PermissionOrganization.Name);
                    sheet.GetRow(2).GetCell(3).SetCellValue(DateTime.Now.ToString("yyyy-MM-dd"));
                    sheet.GetRow(3).GetCell(1).SetCellValue(apply.AssignSubbranch);
                    sheet.GetRow(3).GetCell(3).SetCellValue(apply.AssignCustomerManager);
                    sheet.GetRow(5).GetCell(0).SetCellValue(string.Format("请于{0}之前反馈处理结果", apply.CreateDate.AddDays(5).ToString("yyyy-MM-dd")));
                    workbook.Write(ms);
                    ms.Flush();
                    ms.Position = 0;
                }

                return(ms);
            }
            finally
            {
                ms.Close();
                workbook = null;
                sheet    = null;
            }
        }
Ejemplo n.º 16
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));
            }
        }