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 | 124 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 122 insertions(+), 2 deletions(-) diff --git a/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs b/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs index 738c838..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) { @@ -134,6 +138,15 @@ { jisuangonglinggongzi(); } + + + _logger.LogInformation("鎶婅秴杩�90澶╄繕娌℃湁杞寲鐨勬。妗堝鎴风殑涓氬姟缁忕悊褰掍负鏃�"); + this.ywjlguiling(); + _logger.LogInformation("鎶婅秴杩�90澶╄繕娌℃湁杞寲鐨勬。妗堝鎴风殑涓氬姟缁忕悊褰掍负鏃犳墽琛岀粨鏉�"); + + _logger.LogInformation("鎶婁細鍛樼郴缁熷拰oa绯荤粺鎵嬫満鍙风浉鍚岀殑瀹㈡埛鍏宠仈璧锋潵"); + this.huiyuanguanlian(); + _logger.LogInformation("鎶婁細鍛樼郴缁熷拰oa绯荤粺鎵嬫満鍙风浉鍚岀殑瀹㈡埛鍏宠仈璧锋潵鎵ц缁撴潫"); } catch (Exception ex) { @@ -205,6 +218,65 @@ _logger.LogInformation("diwutian" + diwutian); _logger.LogInformation("DateTime.Now" + DateTime.Now.Date); return diwutian; + } + + + //鎶婅秴杩�90澶╄繕娌℃湁杞寲鐨勬。妗堝鎴风殑涓氬姟缁忕悊褰掍负鏃� + public void ywjlguiling() + { + var intentionCustomerDTOs = _intentionCustomerService.GetList().Where(x=>x.Ywjltime < DateTime.Now.AddDays(-90)).ToList(); + + foreach(var intentionCustomerDTO in intentionCustomerDTOs) + { + intentionCustomerDTO.Ywjl = null; + 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(); + } + } //璁$畻鑰冨嫟 @@ -347,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(); @@ -1840,6 +1912,50 @@ //var feijijiandengji = fiPiecerateDTOs.Where(x => x.Standard == "A"); //var jijiandengji = fiPiecerateDTOs.Where(x => x.Standard == "A"); + #region 閲囪喘鍏憡褰曞叆 + + var caigougonggaoDTOsyue = _projectService.GetcaigougonggaoListsalary(userList[i].Id, dateminkaoqin, datemaxkaoqin); + if (caigougonggaoDTOsyue != null && caigougonggaoDTOsyue.Count > 0) + { + var jijianidddd = fiPiecerateDTOs.Where(x => x.Project == "閲囪喘鍏憡褰曞叆").FirstOrDefault(); + if (jijianidddd != null) + { + var jixiaotichengfangan = hrJixiaotichengThis.Where(x => x.PiecerateId == jijianidddd.Id).OrderByDescending(x => x.Effecttime).FirstOrDefault(); + if (jixiaotichengfangan != null && jixiaotichengfangan.Ticheng.HasValue && jixiaotichengfangan.Renwu.HasValue) + { + if (jixiaotichengfangan.Renwustandard == "01") + { + decimal renwujishu = admAttendanceDTO.Yingchuqin * jixiaotichengfangan.Renwu.Value; + if (jixiaotichengfangan.Tichengstandard == "01") + { + decimal youxiaojijian = caigougonggaoDTOsyue.Count - renwujishu; + if (youxiaojijian > 0) + { + hrSalaryDTO.Jixiaoticheng += Math.Round(jixiaotichengfangan.Ticheng.Value * youxiaojijian, 2); + } + + } + + } + else if (jixiaotichengfangan.Renwustandard == "02") + { + decimal renwujishu = jixiaotichengfangan.Renwu.Value; + if (jixiaotichengfangan.Tichengstandard == "01") + { + decimal youxiaojijian = caigougonggaoDTOsyue.Count - renwujishu; + if (youxiaojijian > 0) + { + hrSalaryDTO.Jixiaoticheng += Math.Round(jixiaotichengfangan.Ticheng.Value * youxiaojijian, 2); + } + + } + } + } + + } + } + #endregion + #region 閲囪喘椤圭洰褰曞叆 var projectDTOsyue = _projectService.GetListsalary(userList[i].Id, dateminkaoqin, datemaxkaoqin); @@ -1884,8 +2000,12 @@ } #endregion + + + + #region 瀹㈡埛璧勬枡褰曞叆 - + var _intentionCustomerDTOs = _intentionCustomerService.GetListsalary(userList[i].Id, dateminkaoqin, datemaxkaoqin); if (_intentionCustomerDTOs!=null && _intentionCustomerDTOs.Count > 0) { -- Gitblit v1.9.1