username@email.com
2023-02-03 c28a5cd5367ba6a0d210dc897fd9a7cf6e46e570
把会员系统和oa系统手机号相同的客户关联起来
1个文件已修改
56 ■■■■■ 已修改文件
zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs
@@ -51,6 +51,8 @@
        private readonly IAskService _askService;
        private readonly IAdmEvaluateService _admEvaluateService;
        private readonly IExpertService _expertService;
        private readonly zhengcaioaContext _context;
        private readonly zcUserInfoN_dbContext _zcUsercontext;
        private readonly decimal jiabangongzibiaozhun = new decimal(21.5);
        public TimedBackgroundService(ILogger<TimedBackgroundService> logger, IServiceScopeFactory factory)
@@ -85,6 +87,8 @@
            _askService= factory.CreateScope().ServiceProvider.GetRequiredService<IAskService>();
            _admEvaluateService = factory.CreateScope().ServiceProvider.GetRequiredService<IAdmEvaluateService>();
            _expertService = factory.CreateScope().ServiceProvider.GetRequiredService<IExpertService>();
            _context = factory.CreateScope().ServiceProvider.GetRequiredService<zhengcaioaContext>();
            _zcUsercontext = factory.CreateScope().ServiceProvider.GetRequiredService<zcUserInfoN_dbContext>();
        }
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
@@ -104,8 +108,6 @@
                    try
                    {
                        _logger.LogInformation("判断是否是第五个工作日结束");
                        DateTime diwutian = this.diwugongzuori();
                        //第五个工作日结束后开始计算
@@ -140,8 +142,11 @@
                        _logger.LogInformation("把超过90天还没有转化的档案客户的业务经理归为无");
                        this.ywjlguiling();
                        _logger.LogInformation("把超过90天还没有转化的档案客户的业务经理归为无执行结束");
                        _logger.LogInformation("把会员系统和oa系统手机号相同的客户关联起来");
                        this.huiyuanguanlian();
                        _logger.LogInformation("把会员系统和oa系统手机号相同的客户关联起来执行结束");
                    }
                    catch (Exception ex)
                    {
@@ -229,6 +234,51 @@
            }
        }
        //把会员系统和oa系统手机号相同的客户关联起来
        public void huiyuanguanlian()
        {
            var cooperatecustomCustomers = _context.CooperatecustomCustomers.Where(x => x.RecStatus == "A" && x.HuiyuanId == null).ToList();
            var frameworkUsers = _zcUsercontext.FrameworkUsers.Where(x => x.IsValid == true).ToList();
            if (cooperatecustomCustomers != null && cooperatecustomCustomers.Count > 0)
            {
                foreach (var cooperatecustomCustomer in cooperatecustomCustomers)
                {
                    if (!string.IsNullOrEmpty(cooperatecustomCustomer.Tel))
                    {
                        var frameworkUser = frameworkUsers.Where(x => x.Itcode == cooperatecustomCustomer.Tel).FirstOrDefault();
                        if (frameworkUser != null)
                        {
                            cooperatecustomCustomer.HuiyuanId = frameworkUser.Id.ToString();
                        }
                    }
                }
                _context.SaveChanges();
            }
            var intentionCustomers = _context.IntentionCustomers.Where(x => x.RecStatus == "A" && x.HuiyuanId == null).ToList();
            if (intentionCustomers != null && intentionCustomers.Count > 0)
            {
                foreach (var intentionCustomer in intentionCustomers)
                {
                    if (!string.IsNullOrEmpty(intentionCustomer.Tel))
                    {
                        var frameworkUser = frameworkUsers.Where(x => x.Itcode == intentionCustomer.Tel).FirstOrDefault();
                        if (frameworkUser != null)
                        {
                            intentionCustomer.HuiyuanId = frameworkUser.Id.ToString();
                        }
                    }
                }
                _context.SaveChanges();
            }
        }
        //计算考勤
        public void jisuankaoqin()
        {