Example #1
0
        public ActionResult GroupIndex()
        {
            SalesGroupDAL sgdal  = new SalesGroupDAL();
            var           sglist = sgdal.GetAll().ToList().Select(t => new SalesGroupViewModel().CastModel(t));

            return(View(sglist));
        }
Example #2
0
        public IEnumerable <SelectListItem> GroupBySales(string id)
        {
            SalesGroupDAL dal   = new SalesGroupDAL();
            SalesManDAL   sd    = new SalesManDAL();
            var           sales = sd.Get(id);

            var viewList = new List <SelectListItem>();
            var list     = dal.GetAll();

            foreach (var vi in list)
            {
                SelectListItem se = new SelectListItem();
                se.Text  = vi.Name;
                se.Value = vi.ID.ToString();
                if (sales != null && sales.GroupID == vi.ID)
                {
                    se.Selected = true;;
                }
                viewList.Add(se);
            }
            viewList.Insert(0, new SelectListItem()
            {
                Value = string.Empty, Text = "请选择"
            });
            return(viewList);
        }
Example #3
0
        /// <summary>
        /// 按日查询汇总数据
        /// </summary>
        /// <param name="date">日期</param>
        /// <returns>日统计数据</returns>
        public GetDayStatisticsOutput GetDayStatistics(DateTime date)
        {
            GetDayStatisticsOutput output = new GetDayStatisticsOutput();

            output.StatisticsDate = new DateTime(date.Year, date.Month, date.Day);

            var salesGroups = _salesGroupDal.GetAll().Where(p => p.State == 1);

            salesGroups.ForEach(p => output.DayStatistics.Add(GetSingleGroupStatistics(p, output.StatisticsDate)));

            return(output);
        }
Example #4
0
        public ActionResult GetSalesGroup(string districtId)
        {
            SalesGroupDAL sgdal  = new SalesGroupDAL();
            var           sglist = sgdal.GetAll().Where(t => t.DistrictID == districtId && t.State == 1).Select(x => new
            {
                ID   = x.ID,
                Name = x.Name
            }).ToList();
            BaseResponse <object> br = new BaseResponse <object>();

            br.Status = "Success";
            br.Data   = sglist;
            return(Json(br, JsonRequestBehavior.AllowGet));
        }
Example #5
0
        public IEnumerable <SelectListItem> GroupList(string id)
        {
            SalesGroupDAL dal      = new SalesGroupDAL();
            var           viewList = new List <SelectListItem>();
            var           list     = dal.GetAll();

            foreach (var vi in list)
            {
                SelectListItem se = new SelectListItem();
                se.Text  = vi.Name;
                se.Value = vi.ID.ToString();
                if (id == vi.ID)
                {
                    se.Selected = true;;
                }
                viewList.Add(se);
            }
            return(viewList);
        }
Example #6
0
        /// <summary>
        /// 案件号生成
        /// </summary>
        /// <param name="salesGroupId">销售组Id</param>
        /// <returns>案件号</returns>
        public string GenCaseNumber(string salesGroupId)
        {
            var salesGroup = _salesGroupDal.GetAll().First(p => p.ID == salesGroupId);

            if (salesGroup.IsNull())
            {
                throw new Exception(string.Format("查询不到id为{0}的销售组信息", salesGroupId));
            }

            string maxCaseNumber =
                _baseCaseDal.GetAll().Max(s => s.NewCaseNum.Substring(s.NewCaseNum.Length - 6, s.NewCaseNum.Length));

            if (maxCaseNumber.IsNotNullOrEmpty())
            {
                return("L" + salesGroup.ShortCode + "-" + (Convert.ToInt32(maxCaseNumber) + 1).ToString("d6"));
            }

            return(string.Format("L{0}-000001", salesGroup.ShortCode));
        }
Example #7
0
        private void UpdateAuditCaseNum(BaseAuditDAL baseAuditDal, SalesGroupDAL salesGroupDal)
        {
            string[] caseNum = baseAuditDal.GetAll().Where(p => p.CaseNum != null).Select(p => p.CaseNum).Distinct().ToArray();
            caseNum.ForEach(p =>
            {
                var sameCaseNumCases = baseAuditDal.GetAllBase().Where(c => c.CaseNum == p).ToList();
                var salesGroupId     = sameCaseNumCases.First().SalesGroupID;

                var salesGroup = salesGroupDal.GetAll().First(t => t.ID == salesGroupId);
                sameCaseNumCases.ForEach(t =>
                {
                    t.CaseNum    = (Convert.ToInt32(t.CaseNum.Substring(4)) + 100000).ToString();
                    t.NewCaseNum = "L" + salesGroup.ShortCode + "-" + t.CaseNum;
                });

                baseAuditDal.UpdateRange(sameCaseNumCases);
                baseAuditDal.AcceptAllChange();
            });
        }
Example #8
0
        public ActionResult DatapermissionList(string roleid)
        {
            List <CheckBoxListModel> list = new List <CheckBoxListModel>();
            DistrictDAL       dtdal       = new DistrictDAL();
            SalesGroupDAL     sgdal       = new SalesGroupDAL();
            DictionaryDAL     dicdal      = new DictionaryDAL();
            DataPermissionDAL ddal        = new DataPermissionDAL();
            var dpuer     = ddal.GetAll().Where(t => t.RoleID == roleid).Select(t => t.DataPermissionID);
            var dataplist = dtdal.GetAll().Select(t => new { t.ID, t.Name })
                            .Union(dicdal.GetAll(t => t.ParentKey == "-ThirdPlatform").Select(t => new { ID = t.Path, Name = t.Text }))
                            .Union(sgdal.GetAll().Select(t => new { t.ID, t.Name }));

            foreach (var t in dataplist)
            {
                list.Add(new CheckBoxListModel(t.ID, t.Name, dpuer.Contains(t.ID)));
            }

            //为数据权限增加 自有资金
            list.Add(new CheckBoxListModel(CaseMode.ZiYouZiJin, "自有资金", dpuer.Contains(CaseMode.ZiYouZiJin)));
            //为数据权限增加 未选择
            list.Add(new CheckBoxListModel(CaseMode.WeiXuanZe, "未选择案件模式", dpuer.Contains(CaseMode.WeiXuanZe)));
            return(View(list));
        }
Example #9
0
 public IEnumerable <SalesGroup> GetAll()
 {
     return(_salesGroup.GetAll().ToList());
 }
        // todo switch to private method
        public IEnumerable <AfterCase> GetAfterCaseByData(DateTime startTime, DateTime?endTime)
        {
            IQueryable <BaseAudit> baseAudits = GetAllAfterCases().Where(p => p.CreateTime >= startTime);

            if (endTime.HasValue)
            {
                baseAudits = baseAudits.Where(p => p.CreateTime < endTime);
            }
            baseAudits = baseAudits.OrderBy(p => p.CreateTime);

            var afterCases = new List <AfterCase>();
            List <Dictionary> dictionaries = _dictionaryBll.QueryByParentKey("-ThirdPlatform").ToList();

            foreach (var audit in baseAudits)
            {
                // 获取借款人
                RelationPersonAudit customer = _relationPersonAuditDal.GetAll().Single(p => p.AuditID == audit.ID && p.RelationType == "-PersonType-JieKuanRen");

                Lending lendingInfo = audit.NewCaseNum.Contains("HIS") ? _lendingDal.GetHIS(audit.ID) : _lendingDal.Get(audit.ID);

                SalesGroup salesGroup = _salesGroupDal.GetAll().Single(p => p.ID == audit.SalesGroupID);

                PublicMortgage mortgage = _mortgageBll.Query(audit.NewCaseNum);

                var fundDictionary = dictionaries.FirstOrDefault(p => p.Path == audit.ThirdParty);


                // 借款人和共同借款人
                var debtNames =
                    _relationPersonAuditDal.GetAll()
                    .Where(
                        p =>
                        p.AuditID == audit.ID &&
                        (p.RelationType == "-PersonType-JieKuanRen" || p.IsCoBorrower == 1)).Select(p => p.Name);

                var afterase = new AfterCase();

                afterase.CaseNum                      = audit.NewCaseNum;
                afterase.SalesGrouptId                = salesGroup.CompanyCode;
                afterase.SalesCompanyName             = salesGroup.Company;
                afterase.CompanyCode                  = salesGroup.Company.PadRight(4).Substring(0, 4);
                afterase.CustomerId                   = customer.ID;
                afterase.CustomerName                 = audit.BorrowerName;
                afterase.CustomerIdentificationType   = customer.IdentificationType;
                afterase.CustomerIdentificationNumber = customer.IdentificationNumber;
                afterase.AccountName                  = audit.OpeningSite ?? string.Empty;
                afterase.EarnestMoney                 = audit.CustEarnestMoney.ToString();
                afterase.DebtName                     = string.Join(",", debtNames.ToArray());
                afterase.LenderName                   = audit.LenderName ?? string.Empty;

                afterase.LoanTerm             = audit.AuditTerm ?? string.Empty;
                afterase.LendingDate          = lendingInfo.LendTime == null ? "" : lendingInfo.LendTime.ToString();
                afterase.PaymentDay           = lendingInfo.PaymentDay == null ? "" : lendingInfo.PaymentDay.ToString();
                afterase.ContractAmount       = audit.NewCaseNum.Contains("HIS") ? lendingInfo.ContractAmount.ToString() : mortgage.ContractAmount.ToString();
                afterase.ContractInterestRate = CONTRACT_INTEREST_RATE;
                afterase.RealInterestRate     = audit.AuditRate > 2M ? audit.AuditRate.ToString() : (audit.AuditRate * 12).ToString(); // 审计利率*12=实际年利率

                afterase.ReceiveType      = RECEIVE_TYPE;
                afterase.FundId           = audit.ThirdParty ?? string.Empty;
                afterase.FundInterestRate = GetThirdPartyRate(audit);
                afterase.FundName         = fundDictionary == null ? string.Empty : fundDictionary.Text;
                // 债转资金当作自有资金处理
                afterase.LoadType       = audit.CaseMode == DictionaryType.CaseMode.ZhaiZhuan ? DictionaryType.CaseMode.ZiYouZiJin : audit.CaseMode;
                afterase.VirtualAccount = "";
                afterase.ContractNum    = mortgage.ContractNo;

                afterCases.Add(afterase);
            }

            return(afterCases);
        }
Example #11
0
        public void InsertHisCase()
        {
            var migDAL        = new MigTDAL();
            var personDAL     = new RelationPersonAuditDAL();
            var salesGroupDAL = new SalesGroupDAL();
            var miglist       = migDAL.GetAll();

            if (miglist.Any())
            {
                var salesGroups = salesGroupDAL.GetAll().ToList();

                int i = 1;
                foreach (var mig in miglist)
                {
                    var audit = new BaseAudit();
                    audit.ID      = Guid.NewGuid().ToString();
                    audit.CaseNum = i.ToString("d6");

                    audit.BorrowerName = mig.CO2;
                    audit.BankCard     = mig.CO30;
                    // 所属分公司名称 新的案件编号
                    switch (mig.CO4)
                    {
                    case "北京泓申":
                        audit.SalesGroupID = salesGroups.First(x => x.Name == "北京泓申投资管理有限公司").ID;
                        audit.DistrictID   = salesGroups.First(x => x.Name == "北京泓申投资管理有限公司").DistrictID;
                        audit.SalesID      = "bff3003c-bfcb-4c34-898d-c9799db56e68";

                        break;

                    case "诚驰":
                        audit.SalesGroupID = salesGroups.First(x => x.Name == "上海诚驰泓申投资管理有限公司").ID;
                        audit.DistrictID   = salesGroups.First(x => x.Name == "上海诚驰泓申投资管理有限公司").DistrictID;
                        audit.SalesID      = "0d17d335-6c79-4130-82d5-16173c142911";

                        break;

                    case "上海泓申":
                        audit.SalesGroupID = salesGroups.First(x => x.Name == "上海泓申投资管理有限公司").ID;
                        audit.DistrictID   = salesGroups.First(x => x.Name == "上海泓申投资管理有限公司").DistrictID;
                        audit.SalesID      = "34965801-2ba7-4a80-a40b-7aff4f5c36a7";
                        break;

                    case "铉宇":
                        audit.SalesGroupID = salesGroups.First(x => x.Name == "上海铉宇金融信息服务有限公司").ID;
                        audit.DistrictID   = salesGroups.First(x => x.Name == "上海铉宇金融信息服务有限公司").DistrictID;
                        audit.SalesID      = "f68acef9-b478-4ab0-ac43-ccaf6bf77988";
                        break;

                    case "银携":
                        audit.SalesGroupID = salesGroups.First(x => x.Name == "上海银携投资管理有限公司").ID;
                        audit.DistrictID   = salesGroups.First(x => x.Name == "上海银携投资管理有限公司").DistrictID;
                        audit.SalesID      = "028bcc6f-dc7d-4994-9f2e-196b5cf974ad";

                        break;

                    default:
                        audit.NewCaseNum = "HIS" + "-" + audit.CaseNum;
                        break;
                    }
                    audit.EarnestMoney = string.IsNullOrEmpty(mig.CO7) ? (decimal?)null : Convert.ToDecimal(mig.CO7);
                    audit.LenderName   = mig.CO8;
                    audit.NewCaseNum   = "HIS" + "-" + audit.CaseNum;
                    // 客户贷款期数
                    switch (mig.CO9)
                    {
                    case "1": audit.Term = "-LoanTerm-1M"; break;

                    case "2": audit.Term = "-LoanTerm-2M"; break;

                    case "3": audit.Term = "-LoanTerm-3M"; break;

                    case "4": audit.Term = "-LoanTerm-4M"; break;

                    case "5": audit.Term = "-LoanTerm-5M"; break;

                    case "6": audit.Term = "-LoanTerm-6M"; break;

                    case "12": audit.Term = "-LoanTerm-12M"; break;

                    case "24": audit.Term = "-LoanTerm-24M"; break;

                    default:
                        audit.Term = "-LoanTerm-2M"; break;
                        break;
                    }
                    audit.AuditTerm = audit.Term;

                    audit.LendingDate = string.IsNullOrEmpty(mig.CO10) ? default(DateTime?) : Convert.ToDateTime(mig.CO10);
                    audit.PaymentDate = string.IsNullOrEmpty(mig.CO11) ? default(DateTime?) : Convert.ToDateTime(mig.CO11);
                    audit.LoanAmount  = string.IsNullOrEmpty(mig.CO13) ? default(decimal?) : Convert.ToDecimal(mig.CO13);
                    audit.AuditAmount = audit.LoanAmount;

                    audit.AnnualRate = string.IsNullOrEmpty(mig.CO14) ? null : (decimal?)Convert.ToDecimal(mig.CO14);
                    audit.AuditRate  = audit.AnnualRate;

                    // 资金方名称
                    switch (mig.CO18)
                    {
                    case "点融": audit.ThirdParty = "-ThirdPlatform-DianRong"; break;

                    case "聚财猫": audit.ThirdParty = "-ThirdPlatform-JuCaiMao"; break;

                    case "米缸": audit.ThirdParty = "-ThirdPlatform-MiGang"; break;

                    case "诺亚": audit.ThirdParty = "-ThirdPlatform-NuoYa"; break;

                    case "挖财": audit.ThirdParty = "-ThirdPlatform-WaCai"; break;

                    default:
                        break;
                    }
                    audit.ThirdPartyAuditRate   = string.IsNullOrEmpty(mig.CO19) ? null : (decimal?)Convert.ToDecimal(mig.CO19);
                    audit.ThirdPartyAuditAmount = string.IsNullOrEmpty(mig.CO28) ? null : (decimal?)Convert.ToDecimal(mig.CO28);
                    switch (mig.CO27)
                    {
                    case "1": audit.ThirdPartyAuditTerm = "-LoanTerm-1M"; break;

                    case "2": audit.ThirdPartyAuditTerm = "-LoanTerm-2M"; break;

                    case "3": audit.ThirdPartyAuditTerm = "-LoanTerm-3M"; break;

                    case "4": audit.ThirdPartyAuditTerm = "-LoanTerm-4M"; break;

                    case "5": audit.ThirdPartyAuditTerm = "-LoanTerm-5M"; break;

                    case "6": audit.ThirdPartyAuditTerm = "-LoanTerm-6M"; break;

                    case "12": audit.ThirdPartyAuditTerm = "-LoanTerm-12M"; break;

                    case "24": audit.ThirdPartyAuditTerm = "-LoanTerm-24M"; break;

                    default:
                        break;
                    }
                    // 贷款模式
                    switch (mig.CO20)
                    {
                    case "居间": audit.CaseMode = "-CaseMode-JuJian"; break;

                    case "债转": audit.CaseMode = "-CaseMode-ZhaiZhuan"; break;

                    default: audit.CaseMode = "-CaseMode-ZiYouZiJin"; break;
                    }

                    audit.OpeningBank = mig.CO23;
                    audit.BankCard    = mig.CO26;
                    audit.CaseDetail  = mig.CO30;
                    audit.CreateTime  = DateTime.Now;
                    audit.CreateUser  = "******";
                    audit.CaseStatus  = "After";



                    var person = new RelationPersonAudit();
                    person.ID           = Guid.NewGuid().ToString();
                    person.AuditID      = audit.ID;
                    person.Name         = mig.CO2;
                    person.RelationType = "-PersonType-JieKuanRen";
                    switch (mig.CO5)
                    {
                    case "香港居民身份证":
                        person.IdentificationType = "-DocType-HongKong";
                        break;

                    case "身份证":
                        person.IdentificationType = "-DocType-IDCard";
                        break;

                    case "台湾同胞来往内地通行证":
                        person.IdentificationType = "-DocType-Taiwan";
                        break;

                    default:
                        person.IdentificationType = "-DocType-Passport";
                        break;
                    }


                    person.IdentificationNumber = mig.CO6;

                    personDAL.Add(person);

                    var lend    = new Com.HSJF.Framework.EntityFramework.Model.Lending.Lending();
                    var lenddal = new LendingDAL();
                    lend.ID       = audit.ID;
                    lend.Borrower = audit.BorrowerName;
                    //lend.ContactNumber = mig.CO0;
                    lend.ContractAmount = audit.AuditAmount;
                    lend.CreateTime     = DateTime.Now.ToShortDateString();
                    lend.CreateUser     = "******";
                    lend.CustomerName   = audit.BorrowerName;
                    lend.LendTime       = audit.LendingDate;
                    lend.PaymentDay     = string.IsNullOrEmpty(mig.CO12) ? default(int?) : Convert.ToInt32(mig.CO12);
                    lenddal.Add(lend);

                    _baseAuditDal.Add(audit);
                    mig.Status = audit.NewCaseNum;
                    migDAL.Update(mig);
                    i++;
                }
            }
            _baseAuditDal.AcceptAllChange();
            migDAL.AcceptAllChange();
        }