private static void DoJob() { var taskId1 = new Guid("6cf07554-9b2e-4e18-9c73-5e15c16a801c"); //绑定微信 var taskId2 = new Guid("6128230d-8a6d-495a-91e2-08fd476d9355"); //关注公众号 //dev //var taskId1=new Guid("6A19450D-A1C1-455F-B49D-06EDEF6A1827"); //var taskId2=new Guid("5897E3CC-5B7C-49BB-AF5F-22780DDCE234"); var start = 0; const int step = 1000; var maxPkId = 731398; var watcher = new Stopwatch(); while (start <= maxPkId) { watcher.Start(); var data = DalTask.GetWXTaskInfo(start, step); var result = new Tuple <int, int>(0, 0); if (data.Any()) { var data1 = data.Where(g => g.BindType.ToLower().Equals("weixinappopen")).Select(g => g.UserId).Distinct() .ToList(); Logger.Info($"绑定微信{data1.Count}条有效数据"); if (data1.Any()) { var dat2 = DalTask.CheckWxTaskUserId(data1, taskId1, Logger); if (dat2.Any()) { result = DalTask.InitUserTaskInfo(dat2, taskId1, "4BindWX", Logger, 2); } Logger.Info($"4BindWX/{result.Item1}/{result.Item2}"); } var data2 = data.Where(g => g.BindType.ToLower().Equals("winxin_officialaccount")).Select(g => g.UserId).Distinct() .ToList(); Logger.Info($"关注公众号{data2.Count}条有效数据"); if (data2.Any()) { var dat2 = DalTask.CheckWxTaskUserId(data2, taskId2, Logger); if (dat2.Any()) { result = DalTask.InitUserTaskInfo(dat2, taskId2, "5Follow", Logger, 2); } Logger.Info($"5Follow/{result.Item1}/{result.Item2}"); } } start += step; watcher.Stop(); Logger.Info($"微信任务初始化,最大的PKID==>{start + step},第{start / step + 1}批数据,共{maxPkId / step + 1}批,,用时{watcher.ElapsedMilliseconds}毫秒"); watcher.Reset(); } watcher.Stop(); }
private void DoJob() { var count = DalTask.GetCarUserCount(); if (count == 0) { Logger.Warn("查询添加车辆任务初始化用户数量为0"); return; } var step = 3000; var start = 0; Logger.Info($"查询添加车辆任务初始化数据为{count}条,每批{step}条,共{count / step + 1}批"); var watcher = new Stopwatch(); var taskId = new Guid("4c24109b-2d80-449b-b074-52c877dacfa0"); //var taskId = new Guid("951BE020-E3A5-40EC-A234-EA67E71E8E90"); var guidPara = Guid.Empty; var Coo = 0; var Coo1 = 0; var Coo2 = 0; while (start < count) { var result = new Tuple <int, int>(0, 0); watcher.Start(); var data = DalTask.GetCarUserList(guidPara, step); var dat = data.Where(g => g.u_user_id != null && g.u_user_id != Guid.Empty && !string.IsNullOrWhiteSpace(g.u_cartype_pid_vid)).Select(g => g.u_user_id.Value).ToList(); var dat2 = DalTask.CheckTaskUserId(dat, taskId, Logger); var count2 = dat2.Count; Coo += count2; Coo1 += data.Count; Coo2 += dat.Count; if (count2 > 0) { result = DalTask.InitUserTaskInfo(dat2, taskId, "6AddCar", Logger); } watcher.Stop(); start += step; Logger.Info($"添加车辆任务初始化,起始GUID==>{guidPara:D},第{start / step + 1}批数据,共{count / step + 1}批,有效数据{count2}条,插入用户任务信息表{result.Item1}条,插入用户任务详情表{result.Item2}条,用时{watcher.ElapsedMilliseconds}毫秒"); guidPara = data.Last().CarId; watcher.Reset(); } Logger.Info($"{Coo1}==>{Coo2}==>{Coo}"); watcher.Stop(); }
public void DoJob() { var watcher = new Stopwatch(); var taskId = new Guid("af1c225b-4601-481e-94a7-43682975511b"); //var taskId = new Guid("C185431C-6FCB-4F46-8824-98B6DEC5934B"); var userCount = 18778722; //var userCount = 10000000; Logger.Info($"共{userCount}条订单信息进行需要首单初始化"); if (userCount == 0) { return; } var step = 3000; var start = 0; while (start < userCount) { watcher.Start(); var userList = DalTask.GetFirstOrderUserList(start, step); var count = 0; var result = new Tuple <int, int>(0, 0); if (userList.Any()) { var data = userList.Where(g => g.UserId != null && g.UserId != Guid.Empty && (((g.InstallShopId == null || g.InstallShopId == 0) && g.DeliveryStatus == "3.5Signed") || (g.InstallShopId > 0 && g.InstallStatus == "2Installed"))).Select(g => g.UserId.Value).Distinct().ToList(); var dat = DalTask.CheckTaskUserId(data, taskId, Logger); count = dat.Count; if (count > 0) { result = DalTask.InitUserTaskInfo(dat, taskId, "1FirstOrder", Logger); } } watcher.Stop(); Logger.Info($"首单任务初始化,最大的PKID==>{start + step},第{start / step + 1}批数据,共{userCount / step + 1}批,有效数据{count}条,插入用户任务表共==>{result.Item1}条,插入用户任务详情==>{result.Item2}条数据,用时{watcher.ElapsedMilliseconds}毫秒"); //Thread.Sleep(3000); watcher.Reset(); start += step; } watcher.Stop(); }
private void DoJob() { var watcher = new Stopwatch(); var taskId = new Guid("6128230d-8a6d-495a-91e2-08fd476d9355");//关注公众号TaskId //var taskId = new Guid("5897E3CC-5B7C-49BB-AF5F-22780DDCE234");//dev const int userCount = 1484709; Logger.Info($"共{userCount}条用户信息进行需要首单初始化"); const int step = 3000; var start = 0; while (start < userCount) { watcher.Start(); var userList = DalTask.GetBindWxInfoList(start, step, false); var count = 0; var result = new Tuple <int, int>(0, 0); if (userList.Any()) { var data = userList.Where(g => g.AuthSource.ToLower().Equals("weixin") && g.BindingStatus.ToLower().Equals("bound") && g.UserId != null && !string.IsNullOrWhiteSpace(g.UnionId)) .Select(g => g.UserId.Value).Distinct().ToList(); var dat = DalTask.CheckTaskUserId(data, taskId, Logger); count = dat.Count; if (count > 0) { result = DalTask.InitUserTaskInfo(dat, taskId, "5Follow", Logger); } } watcher.Stop(); Logger.Info( $"关注公众号任务初始化,最大的PKID==>{start + step},第{start / step + 1}批数据,共{userCount / step + 1}批,有效数据{count}条,插入用户任务表共==>{result.Item1}条,插入用户任务详情==>{result.Item2}条数据,用时{watcher.ElapsedMilliseconds}毫秒"); watcher.Reset(); start += step; } watcher.Stop(); }
private static void DoJob() { var watcher = new Stopwatch(); var taskId = new Guid("6cf07554-9b2e-4e18-9c73-5e15c16a801c");//绑定微信TaskId //var taskId = new Guid("6A19450D-A1C1-455F-B49D-06EDEF6A1827");//dev const int userCount = 2552500; Logger.Info($"共{userCount}条用户信息进行绑定微信初始化"); const int step = 3000; var start = 0; while (start < userCount) { watcher.Start(); var userList = DalTask.GetBindWxInfoList(start, step); var count = 0; var result = new Tuple <int, int>(0, 0); if (userList.Any()) { var data = userList.Where(g => g.AuthSource.ToLower().Equals("weixin") && g.BindingStatus.ToLower().Equals("bound") && g.UserId != null) .Select(g => g.UserId.Value).Distinct().ToList(); var dat = DalTask.CheckTaskUserId(data, taskId, Logger); count = dat.Count; if (count > 0) { result = DalTask.InitUserTaskInfo(dat, taskId, "4BindWX", Logger); } } watcher.Stop(); Logger.Info($"绑定微信任务初始化,最大的PKID==>{start + step},第{start / step + 1}批数据,共{userCount / step + 1}批,有效数据{count}条,插入用户任务表共==>{result.Item1}条,插入用户任务详情==>{result.Item2}条数据,用时{watcher.ElapsedMilliseconds}毫秒"); watcher.Reset(); start += step; } watcher.Stop(); }