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 | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs b/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs
index 7ce48bc..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,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()
{
--
Gitblit v1.9.1