Ver código fonte

修复每月统计bug

lichunlei 2 anos atrás
pai
commit
09af27f89c
2 arquivos alterados com 10 adições e 10 exclusões
  1. 8 8
      AppStart/Timer/StoreApplyHelper.cs
  2. 2 2
      appsettings.json

+ 8 - 8
AppStart/Timer/StoreApplyHelper.cs

@@ -38,14 +38,14 @@ public class StoreApplyHelper
                     {
                         function.WritePage("/StoreApply/", DateTime.Now.ToString("yyyyMM") + ".txt", DateTime.Now.ToString());
                         Dictionary<int, decimal> dataDic = new Dictionary<int, decimal>();
-                        string pre = DateTime.Now.AddDays(-2).ToString("yyyy-MM") + "-01 00:00:00";
-                        string start = DateTime.Now.AddDays(-1).ToString("yyyy-MM") + "-01 00:00:00";
-                        string end = DateTime.Parse(start).ToString("yyyy-MM-dd HH:mm:ss");
+                        string pre = DateTime.Now.AddMonths(-2).ToString("yyyy-MM") + "-01 00:00:00";
+                        string start = DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01 00:00:00";
+                        string end = DateTime.Parse(start).AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss");
                         DataTable dts = OtherMySqlConn.dtable("select UserId from StoreHouse where CreateDate>='" + pre + "' and CreateDate<'" + end + "' and UserId in (select UserId from (select UserId,count(Id) from StoreHouse group by UserId HAVING count(Id)=1) tb)");
                         foreach(DataRow dr in dts.Rows)
                         {
                             int UserId = int.Parse(function.CheckInt(dr["UserId"].ToString()));
-                            if(dataDic.ContainsKey(UserId))
+                            if(!dataDic.ContainsKey(UserId))
                             {
                                 dataDic.Add(UserId, 20000);
                             }
@@ -54,13 +54,13 @@ public class StoreApplyHelper
                                 dataDic[UserId] += 20000;
                             }
                         }
-                        DataTable dt = OtherMySqlConn.dtable("select StoreId,count(Id) from PosMachinesTwo where TransferTime>='" + start + "' and TransferTime<'" + end + "' and BrandId in (1,2,4,6,7,8) and Status>-1 group by StoreId");
+                        DataTable dt = OtherMySqlConn.dtable("select StoreId,count(Id) from StoreStockChange where CreateDate>='" + start + "' and CreateDate<'" + end + "' and BrandId in (1,2,4,6,7,8) and TransType in (10,11,2) and StoreId>0 group by StoreId");
                         foreach(DataRow dr in dt.Rows)
                         {
                             int StoreId = int.Parse(function.CheckInt(dr["StoreId"].ToString()));
                             int Count = int.Parse(function.CheckInt(dr[1].ToString()));
                             StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
-                            if(dataDic.ContainsKey(store.UserId))
+                            if(!dataDic.ContainsKey(store.UserId))
                             {
                                 dataDic.Add(store.UserId, Count * 200);
                             }
@@ -69,13 +69,13 @@ public class StoreApplyHelper
                                 dataDic[store.UserId] += Count * 200;
                             }
                         }
-                        dt = OtherMySqlConn.dtable("select StoreId,count(Id) from PosMachinesTwo where TransferTime>='" + start + "' and TransferTime<'" + end + "' and BrandId in (3,5,9) and Status>-1 group by StoreId");
+                        dt = OtherMySqlConn.dtable("select StoreId,count(Id) from StoreStockChange where CreateDate>='" + start + "' and CreateDate<'" + end + "' and BrandId in (3,5,9) and TransType in (10,11,2) and StoreId>0 group by StoreId");
                         foreach(DataRow dr in dt.Rows)
                         {
                             int StoreId = int.Parse(function.CheckInt(dr["StoreId"].ToString()));
                             int Count = int.Parse(function.CheckInt(dr[1].ToString()));
                             StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
-                            if(dataDic.ContainsKey(store.UserId))
+                            if(!dataDic.ContainsKey(store.UserId))
                             {
                                 dataDic.Add(store.UserId, Count * 300);
                             }

+ 2 - 2
appsettings.json

@@ -17,8 +17,8 @@
     "Host": "http://localhost:5047/",
     "SourceHost": "http://bs.kexiaoshuang.com/",
     "Database": "KxsMainServer",
-    "SqlConnStr": "server=47.108.231.170;port=3306;user=KxsMain;password=mzeqjriUWore0dwT;database=KxsMainServer;charset=utf8;",
-    "Pxc1SqlConnStr": "server=47.108.231.170;port=3306;user=KxsMain;password=mzeqjriUWore0dwT;database=KxsMainServer;charset=utf8;",
+    "SqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;",
+    "Pxc1SqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;",
     "SpSqlConnStr": "server=47.109.31.237;port=3306;user=KxsSpServer;password=jJ9qKsvwWgQA9xWG;database=KxsSpServer;charset=utf8;",
     "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=1,poolsize=500,preheat=50,asyncPipeline=true",
     "TendisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=1,poolsize=500,preheat=50,asyncPipeline=true",