| | |
| | | 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) |
| | |
| | | _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) |
| | | { |
| | |
| | | |
| | | try |
| | | { |
| | | |
| | | |
| | | _logger.LogInformation("判断是否是第五个工作日结束"); |
| | | DateTime diwutian = this.diwugongzuori(); |
| | | //第五个工作日结束后开始计算 |
| | |
| | | |
| | | _logger.LogInformation("把超过90天还没有转化的档案客户的业务经理归为无"); |
| | | this.ywjlguiling(); |
| | | |
| | | _logger.LogInformation("把超过90天还没有转化的档案客户的业务经理归为无执行结束"); |
| | | |
| | | _logger.LogInformation("把会员系统和oa系统手机号相同的客户关联起来"); |
| | | this.huiyuanguanlian(); |
| | | _logger.LogInformation("把会员系统和oa系统手机号相同的客户关联起来执行结束"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //把会员系统和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() |
| | | { |