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); } }