From c28a5cd5367ba6a0d210dc897fd9a7cf6e46e570 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期五, 03 二月 2023 09:40:06 +0800 Subject: [PATCH] 把会员系统和oa系统手机号相同的客户关联起来 --- zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs | 65 +++++++++++++++++++++++++++++--- 1 files changed, 59 insertions(+), 6 deletions(-) diff --git a/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs b/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs index 7430db2..f91384a 100644 --- a/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs +++ b/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,11 +108,6 @@ try { - _logger.LogInformation("鎶婅秴杩�90澶╄繕娌℃湁杞寲鐨勬。妗堝鎴风殑涓氬姟缁忕悊褰掍负鏃�"); - this.ywjlguiling(); - - _logger.LogInformation("鎶婅秴杩�90澶╄繕娌℃湁杞寲鐨勬。妗堝鎴风殑涓氬姟缁忕悊褰掍负鏃犳墽琛岀粨鏉�"); - _logger.LogInformation("鍒ゆ柇鏄惁鏄浜斾釜宸ヤ綔鏃ョ粨鏉�"); DateTime diwutian = this.diwugongzuori(); //绗簲涓伐浣滄棩缁撴潫鍚庡紑濮嬭绠� @@ -139,6 +138,15 @@ { jisuangonglinggongzi(); } + + + _logger.LogInformation("鎶婅秴杩�90澶╄繕娌℃湁杞寲鐨勬。妗堝鎴风殑涓氬姟缁忕悊褰掍负鏃�"); + this.ywjlguiling(); + _logger.LogInformation("鎶婅秴杩�90澶╄繕娌℃湁杞寲鐨勬。妗堝鎴风殑涓氬姟缁忕悊褰掍负鏃犳墽琛岀粨鏉�"); + + _logger.LogInformation("鎶婁細鍛樼郴缁熷拰oa绯荤粺鎵嬫満鍙风浉鍚岀殑瀹㈡埛鍏宠仈璧锋潵"); + this.huiyuanguanlian(); + _logger.LogInformation("鎶婁細鍛樼郴缁熷拰oa绯荤粺鎵嬫満鍙风浉鍚岀殑瀹㈡埛鍏宠仈璧锋潵鎵ц缁撴潫"); } catch (Exception ex) { @@ -224,6 +232,51 @@ intentionCustomerDTO.Ywjltime = null; _intentionCustomerService.save(intentionCustomerDTO); } + } + + + //鎶婁細鍛樼郴缁熷拰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(); + } + } //璁$畻鑰冨嫟 @@ -366,7 +419,7 @@ admSignInDTO = new AdmSignInDTO(); } //鏌ヨ璇峰亣 璇峰亣鏃堕棿涓嶈兘閲嶅彔 - List<AdmAskLeaveDTO> admAskLeaveDTOMin = admAskLeaveDTOs.Where(x =>/*x.Lavetype != "2" &&*/ x.StratTime < dateminkaoqin.AddDays(1) && x.EndTime > dateminkaoqin).OrderByDescending(x=>x.Createtime).ToList(); + List<AdmAskLeaveDTO> admAskLeaveDTOMin = admAskLeaveDTOs.Where(x => x.Lavetype != "2" && x.StratTime < dateminkaoqin.AddDays(1) && x.EndTime > dateminkaoqin).OrderByDescending(x=>x.Createtime).ToList(); //鏌ヨ閿�鍋� 閿�鍋囨椂闂翠笉鑳介噸鍙� List<AdmAskLeaveOffDTO> admAskLeaveOffDTOMin = admAskLeaveOffDTOs.Where(x => x.StratTime < dateminkaoqin.AddDays(1) && x.EndTime > dateminkaoqin).OrderByDescending(x => x.Createtime).ToList(); -- Gitblit v1.9.1