浏览代码

重跑5月领导人达标奖励

lcl 9 月之前
父节点
当前提交
84b7052ac6
共有 2 个文件被更改,包括 24 次插入10 次删除
  1. 20 6
      AppStart/Helper/LeaderCompPrizeHelper.cs
  2. 4 4
      Startup.cs

+ 20 - 6
AppStart/Helper/LeaderCompPrizeHelper.cs

@@ -48,6 +48,18 @@ namespace MySystem
             }
         }
 
+        public void StartTest()//启动
+        {
+            Thread thread = new Thread(ListenTest);
+            thread.IsBackground = true;
+            thread.Start();
+        }
+
+        public void ListenTest()//启动
+        {
+            Ready("202405");
+        }
+
         public void Ready(string curMonth)
         {
             CustomerSqlConn.op("delete from LeaderCompTradeStat;delete from LeaderCompTmp;delete from LeaderCompPrize;delete from LeaderCompAddTrade;", MysqlConn.SqlConnStr);
@@ -60,6 +72,7 @@ namespace MySystem
             try
             {
                 WebCMSEntities db = new WebCMSEntities();
+                ReadModels.WebCMSEntities readdb = new ReadModels.WebCMSEntities();
                 OpModels.WebCMSEntities opdb = new OpModels.WebCMSEntities();
                 MpMainModels.WebCMSEntities mpmaindb = new MpMainModels.WebCMSEntities();
                 MpMainModels2.WebCMSEntities mpmaindb2 = new MpMainModels2.WebCMSEntities();
@@ -81,10 +94,10 @@ namespace MySystem
                     int UserId = int.Parse(dr["UserId"].ToString());
                     decimal TradeAmount = decimal.Parse(dr["Amt"].ToString());
                     //稳定期B
-                    bool check = db.TradeDaySummary2.Any(m => m.UserId == UserId && m.TradeMonth == month && m.SeoTitle == "team");
+                    bool check = readdb.TradeDaySummary2.Any(m => m.UserId == UserId && m.TradeMonth == month && m.SeoTitle == "team");
                     if (check)
                     {
-                        TradeAmount += db.TradeDaySummary2.Where(m => m.UserId == UserId && m.TradeMonth == month && m.SeoTitle == "team").Sum(m => m.ProfitTradeAmt + m.ProfitDebitTradeAmt);
+                        TradeAmount += readdb.TradeDaySummary2.Where(m => m.UserId == UserId && m.TradeMonth == month && m.SeoTitle == "team").Sum(m => m.ProfitTradeAmt + m.ProfitDebitTradeAmt);
                     }
                     //码牌团队交易额(直联)
                     check = mpmaindb.UserAmountSummary.Any(m => m.UserId == UserId && m.TradeMonth == month && m.SeoTitle == "team" && m.IsAct == 1);
@@ -109,14 +122,14 @@ namespace MySystem
                         TradeAmount += mpmaindb2.UserAmountSummary.Where(m => m.UserId == UserId && m.TradeMonth == month && m.SeoTitle == "team" && m.IsAct == 1).Sum(m => m.TotalAmount);
                     }
                     //广电卡扶持期按1万/张计入职级
-                    check = db.UserTradeMonthSummary.Any(m => m.UserId == UserId && m.TradeMonth == month && m.SeoTitle == "team" && m.BrandId == 14);
+                    check = readdb.UserTradeMonthSummary.Any(m => m.UserId == UserId && m.TradeMonth == month && m.SeoTitle == "team" && m.BrandId == 14);
                     if (check)
                     {
-                        int ActCount = db.UserTradeMonthSummary.Where(m => m.UserId == UserId && m.TradeMonth == month && m.SeoTitle == "team" && m.BrandId == 14).Sum(m => m.ActiveBuddyMerStatus);
+                        int ActCount = readdb.UserTradeMonthSummary.Where(m => m.UserId == UserId && m.TradeMonth == month && m.SeoTitle == "team" && m.BrandId == 14).Sum(m => m.ActiveBuddyMerStatus);
                         ActCount += UserDataDbconn.Instance.GetSimActTradeAmt(UserId, month, "Team");
-                        if(db.UserSimActSummary.Any(m => m.UserId == UserId && m.Kind == 1))
+                        if(readdb.UserSimActSummary.Any(m => m.UserId == UserId && m.Kind == 1))
                         {
-                            ActCount -= db.UserSimActSummary.Where(m => m.UserId == UserId && m.Kind == 1).Sum(m => m.ActCount);
+                            ActCount -= readdb.UserSimActSummary.Where(m => m.UserId == UserId && m.Kind == 1).Sum(m => m.ActCount);
                         }
                         TradeAmount += ActCount * 10000;
                     }
@@ -202,6 +215,7 @@ namespace MySystem
                     function.WriteLog(DateTime.Now.ToString() + "------" + UserId, "领导人达标奖励日志");
                 }
                 db.SaveChanges();
+                readdb.SaveChanges();
                 opdb.Dispose();
                 mpmaindb.Dispose();
                 mpmaindb2.Dispose();

+ 4 - 4
Startup.cs

@@ -166,12 +166,12 @@ namespace MySystem
             // }
             // if(Library.ConfigurationManager.EnvironmentFlag == 2)
             // {
-                LeaderCompPrizeHelper.Instance.Start(); //领导人达标奖
-                RecommandKingHelper.Instance.Start(); //推荐王
-                AddSourcePosSnHelper.Instance.Start(); //补来源机具
+                // LeaderCompPrizeHelper.Instance.Start(); //领导人达标奖
+                // RecommandKingHelper.Instance.Start(); //推荐王
+                // AddSourcePosSnHelper.Instance.Start(); //补来源机具
             // } 
 
-            // RecommandKingHelper.Instance.Recommend();
+            LeaderCompPrizeHelper.Instance.StartTest();
         }
 
         private void InitMain()