From c8acd882f10f151d379a987cb8d9159833ce2f8c Mon Sep 17 00:00:00 2001 From: tq <1916474859@qq,com> Date: Sun, 20 Oct 2024 09:44:29 +0800 Subject: [PATCH] =?UTF-8?q?Task=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyTask/SwapOrderSettleAnAccountTask.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/Service/MyTask/SwapOrderSettleAnAccountTask.cs b/Service/MyTask/SwapOrderSettleAnAccountTask.cs index 17386c0..78493bf 100644 --- a/Service/MyTask/SwapOrderSettleAnAccountTask.cs +++ b/Service/MyTask/SwapOrderSettleAnAccountTask.cs @@ -38,7 +38,7 @@ public class SwapOrderSettleAnAccountTask : ITask public int Interval() { - return 1000 * 2; + return 1000 * 10; } public void Handle() @@ -61,12 +61,13 @@ public class SwapOrderSettleAnAccountTask : ITask List swapOrderList = SwapOrderRepository .QueryListByClause(swapOrder => list.Contains(swapOrder.Sn)); - - if (swapOrderList.Count<=0) + + if (swapOrderList.Count <= 0) { return; } + // 电费单价 decimal electricityTotalFee = StaticStationInfo.ElectricityTotalFee; // 换电服务费用 @@ -82,7 +83,7 @@ public class SwapOrderSettleAnAccountTask : ITask decimal? upNominalEnergy = swapOrderBattery.UpBatterySoc * swapOrderBattery.UpNominalEnergy; // 换下的亏电包soc*亏电包的电池标量 decimal? downNominalEnergy = swapOrderBattery.DownBatterySoc * swapOrderBattery.DownNominalEnergy; - + // 电量费用 decimal? electricCharge = (upNominalEnergy - downNominalEnergy) * electricityTotalFee; @@ -101,18 +102,14 @@ public class SwapOrderSettleAnAccountTask : ITask updateSwapOrderBatteryList.Add(swapOrderBattery); updateSwapOrderList.Add(matchingOrder); - } + } } } - if (updateSwapOrderBatteryList.Count>0) - { - SwapOrderBatteryRepository.Update(updateSwapOrderBatteryList); - } - - if (updateSwapOrderList.Count>0) + if (updateSwapOrderList.Count > 0 && updateSwapOrderBatteryList.Count>0) { SwapOrderRepository.Update(updateSwapOrderList); + SwapOrderBatteryRepository.Update(updateSwapOrderBatteryList); } }