Parcourir la source

添加商户实收交易和活动交易

lcl il y a 1 an
Parent
commit
2368432333
3 fichiers modifiés avec 18 ajouts et 2 suppressions
  1. 11 1
      AppStart/Helper/StatService.cs
  2. 2 0
      PxcModels/MerchantInfo.cs
  3. 5 1
      PxcModels/WebCMSEntities.cs

+ 11 - 1
AppStart/Helper/StatService.cs

@@ -54,7 +54,7 @@ namespace MySystem
                         {
                             ids += idsDr["Id"].ToString() + ",";
                         }
-                        DataTable selfDt = OtherMySqlConn.dtable("select UserId,MerchantId,SnNo,PayMode,IsAct,DATE_FORMAT(CreateDate,'%Y%m%d'),sum(PayMoney),count(Id) from ConsumerOrders where Id in (" + ids.TrimEnd(',') + ") group by UserId,MerchantId,SnNo,PayMode,IsAct,DATE_FORMAT(CreateDate,'%Y%m%d')");
+                        DataTable selfDt = OtherMySqlConn.dtable("select UserId,MerchantId,SnNo,PayMode,IsAct,DATE_FORMAT(CreateDate,'%Y%m%d'),sum(PayMoney),count(Id),sum(MaxDivi) from ConsumerOrders where Id in (" + ids.TrimEnd(',') + ") group by UserId,MerchantId,SnNo,PayMode,IsAct,DATE_FORMAT(CreateDate,'%Y%m%d')");
                         if (selfDt.Rows.Count > 0)
                         {
                             function.WriteLog("统计人数:" + selfDt.Rows.Count + "\n\n", "统计商户和创客交易额日志");
@@ -70,6 +70,8 @@ namespace MySystem
                                 string TradeDate = selfDr[5].ToString();
                                 decimal TradeAmount = decimal.Parse(selfDr[6].ToString());
                                 int TradeCount = int.Parse(selfDr[7].ToString());
+                                decimal MaxDivi = decimal.Parse(selfDr[8].ToString());
+                                decimal ActualAmount = TradeAmount - MaxDivi;
                                 string TradeMonth = TradeDate.Substring(0, 6);
 
                                 //创客交易额
@@ -132,12 +134,19 @@ namespace MySystem
                                 }
                                 merchantStat.TradeAmount += TradeAmount;
                                 merchantStat.TradeCount += TradeCount;
+                                merchantStat.TotalActual += ActualAmount;
 
                                 MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == MerchantId);
                                 if(merchant != null)
                                 {
                                     merchant.TotalAmount += TradeAmount;
                                     merchant.TotalConsumeCount += TradeCount;
+                                    merchant.TotalActual += ActualAmount;
+                                    if(IsAct == 1)
+                                    {
+                                        merchant.TotalActAmount += TradeAmount;
+                                        merchant.TotalActActual += ActualAmount;
+                                    }
                                 }
                                 db.SaveChanges();
 
@@ -157,6 +166,7 @@ namespace MySystem
                                 }
                                 qrcode.TradeAmount += TradeAmount;
                                 qrcode.TradeCount += TradeCount;
+                                qrcode.TotalActual += ActualAmount;
                                 db.SaveChanges();
                             }
                             OtherMySqlConn.op("update ConsumerOrders set Version=1 where Id in (" + ids.TrimEnd(',') + ")");

+ 2 - 0
PxcModels/MerchantInfo.cs

@@ -38,5 +38,7 @@ namespace MySystem.PxcModels
         public int BindStatus { get; set; }
         public DateTime? ActivationDate { get; set; }
         public int ActivationStatus { get; set; }
+        public decimal TotalActActual { get; set; }
+        public decimal TotalActAmount { get; set; }
     }
 }

+ 5 - 1
PxcModels/WebCMSEntities.cs

@@ -5189,7 +5189,7 @@ namespace MySystem.PxcModels
                 entity.Property(e => e.PeriodEnd).HasColumnType("datetime");
 
                 entity.Property(e => e.QualificationType)
-                    .HasColumnType("varchar(30)")
+                    .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
@@ -5969,6 +5969,10 @@ namespace MySystem.PxcModels
 
                 entity.Property(e => e.Status).HasColumnType("int(11)");
 
+                entity.Property(e => e.TotalActActual).HasColumnType("decimal(18,2)");
+
+                entity.Property(e => e.TotalActAmount).HasColumnType("decimal(18,2)");
+
                 entity.Property(e => e.TotalActual).HasColumnType("decimal(18,2)");
 
                 entity.Property(e => e.TotalAmount).HasColumnType("decimal(18,2)");