소스 검색

WiFi推送交易问题

lcl 5 달 전
부모
커밋
15502c660a
3개의 변경된 파일33개의 추가작업 그리고 21개의 파일을 삭제
  1. 1 1
      AppStart/Helper/PosPushDataNewHelper.cs
  2. 2 0
      AppStart/Helper/SycnSpServer/SycnSpTradeWifiService.cs
  3. 30 20
      AppStart/WifiTradeHelper.cs

+ 1 - 1
AppStart/Helper/PosPushDataNewHelper.cs

@@ -321,7 +321,7 @@ namespace MySystem
                 else if (Utils.Instance.IsWifi(int.Parse(trade.ProductType)))
                 {
                     FeeRate = "0.60";
-                    FeeAmt = "0";
+                    FeeAmt = trade.ErrorCode;
                 }
                 Dictionary<string, object> dataContent = new Dictionary<string, object>();
                 dataContent.Add("pos_sn", trade.TradeSnNo); //机具sn

+ 2 - 0
AppStart/Helper/SycnSpServer/SycnSpTradeWifiService.cs

@@ -125,8 +125,10 @@ namespace MySystem
                             // add.LastMonth = TradeMonth;
                             // add.DoMonths = 1;
                             add.Unit = "m";
+                            WifiTradeHelper.Instance.DoOne(db, add.Id, DateTime.Now.ToString("yyyy-MM"));
                             db.SaveChanges();
 
+
                             // if(Months > 0)
                             // {
                                 // decimal TradeAmt = TradeAmount / Months;

+ 30 - 20
AppStart/WifiTradeHelper.cs

@@ -30,7 +30,7 @@ public class WifiTradeHelper
             {
                 if(DateTime.Now.Day == 1 && DateTime.Now.Hour < 6)
                 {
-                    string Month = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
+                    string Month = DateTime.Now.ToString("yyyyMM");
                     string chk = function.ReadInstance("/wifi/trade" + Month + ".txt");
                     if(string.IsNullOrEmpty(chk))
                     {
@@ -147,25 +147,7 @@ public class WifiTradeHelper
         {
             if(trade.Unit == "m" && trade.Duration > 0 && !SnNos.Contains(trade.SnNo))
             {
-                decimal TradeAmt = trade.TradeAmount / trade.Duration;
-                TradeAmt = PublicFunction.NumberFormat(TradeAmt);
-                WifiTradeRecord edit = db.WifiTradeRecord.FirstOrDefault(m => m.Id == trade.Id);
-                if(edit != null)
-                { 
-                    edit.DoMonths += 1;
-                    edit.LastMonth = Month.Replace("-", "");
-
-                    //推送wifi交易给java
-                    PosPushDataNewHelper.Trade(new MySystem.SpModels.TradeRecord()
-                    {
-                        TradeSnNo = edit.SnNo,
-                        MerNo = edit.Remark,
-                        TradeAmount = TradeAmt,
-                        TradeSerialNo = Guid.NewGuid().ToString(),
-                        CreateDate = DateTime.Parse(Month + "-01 00:00:00"),
-                        ProductType = edit.BrandId.ToString(),
-                    });
-                }
+                DoOne(db, trade.Id, Month);
                 SnNos.Add(trade.SnNo);
             }
         }
@@ -173,6 +155,34 @@ public class WifiTradeHelper
         db.Dispose();
     }
 
+    public void DoOne(WebCMSEntities db, int Id, string Month)
+    {
+        WifiTradeRecord edit = db.WifiTradeRecord.FirstOrDefault(m => m.Id == Id);
+        if(edit != null)
+        { 
+            if(edit.LastMonth != Month.Replace("-", ""))
+            {
+                decimal TradeAmt = edit.TradeAmount / edit.Duration;
+                TradeAmt = PublicFunction.NumberFormat(TradeAmt);
+                
+                edit.DoMonths += 1;
+                edit.LastMonth = Month.Replace("-", "");
+
+                //推送wifi交易给java
+                PosPushDataNewHelper.Trade(new MySystem.SpModels.TradeRecord()
+                {
+                    TradeSnNo = edit.SnNo,
+                    MerNo = edit.Remark,
+                    TradeAmount = TradeAmt,
+                    TradeSerialNo = Guid.NewGuid().ToString(),
+                    CreateDate = DateTime.Parse(Month + "-01 00:00:00"),
+                    ProductType = edit.BrandId.ToString(),
+                    ErrorCode = edit.DoMonths == 1 ? edit.TradeAmount.ToString() : "0",
+                });
+            }
+        }
+    }
+
     public void StatTrade(List<TradeDaySummary> statTrade, List<MySystem.ReadModels.Users> users, int UserId, int BrandId, string TradeMonth, decimal TradeAmount)
     {
         MySystem.ReadModels.Users user = users.FirstOrDefault(m => m.Id == UserId) ?? new MySystem.ReadModels.Users();